Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Run/Debug with New Browser Session in Visual Studio

0.00/5 (No votes)
27 Aug 2013 2  
A solution for starting with a new browser session each time you run/debug a VS web project

Introduction

I've been doing this trick for a while now and thought it was worth sharing. The problem is when you rely on cookie values in a web-app, in order to reset these values, you need to remove the cookies manually (or in code) on app start. Not ideal. The solution to this minor annoyance is to set up specific browser sessions that use the "PRIVATE BROWSING" command line parameters of browsers. What happens is when you start a private browsing session, it does not use any cached cookies or other settings so you can test with a clean slate - handy.

Setting It Up

In Visual Studio, select the drop-down arrow to the right of the browser choice window:

Now select "browse with"...

In the dialog that pops up, select "add", and use the "..." button to locate your browser. In Arguments, enter the "in private" command line argument your chosen browser takes.

For chrome, use "-incognito", for Internet Explorer, use "-private". The documented "-private" for Firefox does not seem to work.

Your new run with browser menu should now show the new options:

When you run/debug, you get your new shiney cookie free window!

Enjoy your low-fat "cookie cache free" testing!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here