February 25, 2021
Hot Topics:

Deploying Separate User/Site Configurations with ClickOnce

  • By Matt Goebel and Rachel Baker
  • Send Email »
  • More Articles »

In addition to the using statements, add a reference to System.Web.

Figure 11: Adding the System.Web reference

Now, add the following code to the form's constructor. This code processes parameters from the URL used to deploy or launch the application. Once the parameters have been added to the dictionary collection, they can be used to change the text of the form.

public Form1()

   NameValueCollection nameValueTable = new NameValueCollection();

   if (ApplicationDeployment.IsNetworkDeployed)
      if (ApplicationDeployment.CurrentDeployment.ActivationUri
         != null)
         string queryString =
         nameValueTable =

         string[] values = new string[nameValueTable.Count];

         for (int i = 0; i < nameValueTable.Count; i++)
            values[i] = nameValueTable[i];

   if (nameValueTable.Count > 0)
      if (nameValueTable.Keys[0].ToString().Equals("title"))
         this.Text = nameValueTable["title"].ToString();

Next, right-click on the Project (*.csproj) and select Properties. Navigate to the 'Publish' tab. Enter the folder you created earlier, "C:\ClickOnceDeployment" Next, enter the IIS virtual directory created earlier as the Installation Folder URL. In this example, you are publishing to, installing from, and updating from the same location.

Click here for a larger image.

Figure 12: Configuring the ClickOnce deployment

Page 4 of 5

This article was originally published on February 25, 2009

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date