Reputation: 8919
If you include a query string on the HREF of the "Launch" link on the publish.htm
page that ClickOnce generates when you publish a Windows desktop application:
HREF="MyWindowsApp.application?ARG1=sis&ARG2=boom&ARG3=bah"
then the query string can be accessed and parsed inside the Windows program:
if (ApplicationDeployment.IsNetworkDeployed)
{
string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
nameValueColl = System.Web.HttpUtility.ParseQueryString(queryString);
}
But the NameValueCollection that the HttpUtility
parser returns is case-sensitive. A parameter won't be found if you test for it using the wrong case:
if (ApplicationDeployment.IsNetworkDeployed)
{
string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
nameValueColl = System.Web.HttpUtility.ParseQueryString(queryString);
if (nameValueColl.AllKeys.Contains("arg1") )
{
// we don't get here
}
}
Is there an alternative to System.Web.HttpUtility.ParseQueryString
that uses a case-insensitive comparer?
Upvotes: 2
Views: 386