Click here to Skip to main content
15,391,859 members
Articles / .NET
Posted 27 Aug 2013

Tagged as


3 bookmarked

Run/Debug with New Browser Session in Visual Studio

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
27 Aug 2013CPOL1 min read
A solution for starting with a new browser session each time you run/debug a VS web project


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:

Image 1

Now select "browse with"...

Image 2

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.

Image 3

Image 4

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:

Image 5

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

Image 6

Image 7

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


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chief Technology Officer The DataWorks
United Kingdom United Kingdom
Allen is a consulting architect with a background in enterprise systems. His current obsessions are IoT, Big Data and Machine Learning. When not chained to his desk he can be found fixing broken things, playing music very badly or trying to shape things out of wood. He runs his own company specializing in systems architecture and scaling for big data and is involved in a number of technology startups.

Allen is a chartered engineer, a Fellow of the British Computing Society, and a Microsoft MVP. He writes for CodeProject, C-Sharp Corner and DZone. He currently completing a PhD in AI and is also a ball throwing slave for his dogs.

Comments and Discussions

QuestionRun/Debug with new browser session in Visual Studio Pin
MarcelHorsthuis9-Feb-15 21:26
MemberMarcelHorsthuis9-Feb-15 21:26 
AnswerRe: Run/Debug with new browser session in Visual Studio Pin
DataBytzAI9-Feb-15 22:41
professionalDataBytzAI9-Feb-15 22:41 
QuestionCan't get it to work Pin
Silvabolt13-May-14 6:19
MemberSilvabolt13-May-14 6:19 
AnswerRe: Can't get it to work Pin
DataBytzAI13-May-14 6:36
professionalDataBytzAI13-May-14 6:36 
GeneralRe: Can't get it to work Pin
Silvabolt13-May-14 8:48
MemberSilvabolt13-May-14 8:48 
GeneralRe: Can't get it to work Pin
Silvabolt13-May-14 9:49
MemberSilvabolt13-May-14 9:49 
GeneralRe: Can't get it to work Pin
DataBytzAI13-May-14 9:50
professionalDataBytzAI13-May-14 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.