I need to pass some parameters to clickonce application i.e
http://localhost/publisher/WindowsFormsApplication1.application?username=joeuser
I created simple winform app and publish it with clickonce. When trying to harvest the parameters from the query string I am getting nothing
I did set the target framework to .Net Framework 3.5 . and set the options to enable Allow URL parameters to be passed to application check box shown here
this is what I was trying to do :
1st trial:
2nd trial:
what am I doing wrong ?
tried the following resources at msdn (http://msdn.microsoft.com/en-us/library/ms172242.aspx) and in this blog (http://riyadsthoughts.blogspot.co.il/2010/03/passing-parameters-to-clickonce.html)
is there any sample project that use this clickonce ability ?
http://localhost/publisher/WindowsFormsApplication1.application?username=joeuser
I created simple winform app and publish it with clickonce. When trying to harvest the parameters from the query string I am getting nothing
I did set the target framework to .Net Framework 3.5 . and set the options to enable Allow URL parameters to be passed to application check box shown here
this is what I was trying to do :
1st trial:
var args = AppDomain.CurrentDomain.SetupInformation.ActivationArguments; if (args != null && args.ActivationData != null && args.ActivationData.Length > 0) { var url = new Uri(args.ActivationData[0], UriKind.Absolute); var parameters = HttpUtility.ParseQueryString(url.Query); try { MessageBox.Show(url.Query); //shows empty }catch(Exception ex){ MessageBox.Show("Got " + ex.Message); } }here I didn't got an exception but got empty message box
2nd trial:
here I got thrown to NullReferenceExceptionNameValueCollection nameValueTable = new NameValueCollection(); if (ApplicationDeployment.IsNetworkDeployed){ try{ string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query; MessageBox.Show(queryString); //throws exception
}catch (NullReferenceException ex){
MessageBox.Show("Got Null"); }
}
what am I doing wrong ?
tried the following resources at msdn (http://msdn.microsoft.com/en-us/library/ms172242.aspx) and in this blog (http://riyadsthoughts.blogspot.co.il/2010/03/passing-parameters-to-clickonce.html)
is there any sample project that use this clickonce ability ?