DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Collin M. Barrett
Collin M. Barrett

Posted on • Originally published at collinmbarrett.com on

Incognito Debugging With Any Browser in Visual Studio

Debug Visual Studio in Incognito

Clearing the Cruft

When I develop web applications in Visual Studio, I often need to resolve issues that are dependent on the state of the cache or cookies. By default, debugging in a browser from Visual Studio opens a new browser window but does not purge any preexisting cache or cookies.

Private/Incognito Browsing: Always Fresh

I like to configure Visual Studio to launch browser debug sessions in incognito/private browsing mode. Every debugging session is then fresh as if a user was visiting my application for the first time.

Visual Studio Debug Target Menu
Visual Studio Debug Target Menu

To configure browsers to debug in this mode:

  1. Click the Debug Target control’s right-side chevron to view the list of installed browsers.
  2. Click β€œBrowse With…”.
  3. Click β€œAdd…”.
  4. Configure the new target browser using the private/incognito command line argument. See the examples below.

Sample Browser Configurations

Chrome

Program:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Arguments:
--incognito
Friendly Name:
Google Chrome - Incognito

Internet Explorer

Program:
"C:\Program Files (x86)\Internet Explorer\iexplore.exe"
Arguments:
-private
Friendly Name:
Internet Explorer - InPrivate

Firefox

Program:
"C:\Program Files\Mozilla Firefox\firefox.exe"
Arguments:
-private
Friendly Name:
Firefox - Private

Firefox Developer Edition

Program:
"C:\Program Files\Firefox Developer Edition\firefox.exe"
Arguments:
-private
Friendly Name:
FirefoxDeveloperEdition - Private

Edge

Not yet supported.

Opera

Program:
"C:\Program Files\Opera\launcher.exe"
Arguments:
--private
Friendly Name:
Opera Internet Browser - Private

Visual Studio Private/Incognito Debug Targets
Visual Studio Private/Incognito Debug Targets

via Scott Hanselman

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.