Search code examples
javascripturlvisual-studio-2012parametersstart-page

How to set URL query parameters in Visual Studio on Start Page


Rewording this as I just learned that 'answering your own question on SO is ENCOURAGED', but I didn't use the correct procedure. This is he Jeopardy version.

I'm building a Javascript/HTML5 web site using Visual Studio 2012 for Web. I need to feed in a query parameter to the selected Start page. VS Web allows you to right-click on an html page and select 'Set As Start Page', but no way to set start options. How can I set query options on the launch of my web page from the debugger?


Solution

  • You need to right-click on the project and go to 'Start Options...'.

    In the Start Options dialog you can add query parameters to the 'Specific page:' option. The drop-down in Specific Page allowed you to modify the URL to add your own parameters. E.g. myStartPage.html?myParameter=3

    You can't use the Start URL option with the internal debugger since since you have to specify 'localhost:port/myStartPage?myParameter=3'. VS is unhappy with this and ends up with a 404 page.