Daily Archives: 7 January 2012

Working on a Page With a Query String Parameter

Quite often in web development, we use query strings to pass values to a page. It is a convenient way to pass non-sensitive data to a page, and also makes the URL hackable (allowing users to plug in their own values in the URL and reloading the page for the information relevant to those values).

When developing these pages in ASP.NET webforms, there is a neat little trick that can be employed to save you stacks of time. You can configure   Visual Studio to load a particular URL, with a particular value locked and loaded in the Query String. This saves you having to load the page from which the user must navigate, select/enter values and click a submit button to kick off the navigation to the page which you are working on.

Here’s how:

  1. Click on the Web Project in Solution Explorer and holding down the ALT key, depress the Enter key (or just right-click and click Properties).
  2. Click on the Web tab.
  3. Then, select the Start URL radio button and enter in your URL plus query string as depicted below:

VisualStudioWebProperties

Once you have it all working nicely, you can go back and test the whole thing from the navigation of the previous page to this one.

If you are working on such a page for many hours (even days), this tip will save you heaps of time, and the tediousness of repeatedly clicking through to your destination page.