Click here to Skip to main content
14,358,698 members

Run/Debug with New Browser Session in Visual Studio

Rate this:
5.00 (3 votes)
Please Sign up or sign in to vote.
5.00 (3 votes)
27 Aug 2013CPOL
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:

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!

License

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

Share

About the Author

AJSON
Engineer
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.

Comments and Discussions

 
QuestionRun/Debug with new browser session in Visual Studio Pin
MarcelHorsthuis9-Feb-15 22:26
memberMarcelHorsthuis9-Feb-15 22:26 
AnswerRe: Run/Debug with new browser session in Visual Studio Pin
AJSON9-Feb-15 23:41
mvaAJSON9-Feb-15 23:41 
QuestionCan't get it to work Pin
Silvabolt13-May-14 7:19
memberSilvabolt13-May-14 7:19 
AnswerRe: Can't get it to work Pin
AJSON13-May-14 7:36
mvaAJSON13-May-14 7:36 
GeneralRe: Can't get it to work Pin
Silvabolt13-May-14 9:48
memberSilvabolt13-May-14 9:48 
GeneralRe: Can't get it to work Pin
Silvabolt13-May-14 10:49
memberSilvabolt13-May-14 10:49 
GeneralRe: Can't get it to work Pin
AJSON13-May-14 10:50
mvaAJSON13-May-14 10: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.

Tip/Trick
Posted 27 Aug 2013

Tagged as

Stats

24.3K views
3 bookmarked