views:

3929

answers:

5

In Visual Studio 2010 (RC) there is no longer a "browse with" context menu when right clicking .aspx pages. How can you change the default browser now?

By default it seems to use the operating system default browser, but I would prefer to use IE when debugging ASP.net apps. (I am testing this with ASP.net MVC 2)

+2  A: 

Looks like this is going to be in a future release.

https://connect.microsoft.com/VisualStudio/feedback/details/533930/default-browser-setting-in-vs2010-not-per-project-helps-debug-user-experience

btw, you can change your default browser:- In WindowsXP atleast.. Go to Start > Control Panel > Add and Remove progam> Set Program access and defaults > Choose IE from the Web browser dropdown.

Edited: btw, I did see the "Browse with" item in the right click of an aspx page. When I click on that, I see the list of broswers to choose from. You select one an click "Set as default".

ydobonmai
+2  A: 

Check this out:

How do I set my development web browser in VS2010?

I'm using VS 2010 RC and I can't see the "Browse with..." option too.

Leniel Macaferi
+2  A: 

There is no "Browse With" option on the .aspx Views in an MVC project as they are not meant to be directly browseable.

What I tend to do is add a Default.aspx webform in the root of the site and this, when right clicked, will give you the Browse With option. You need to make sure to update your routing though otherwise IIS/Cassini will try to serve it up, something like this

   public void Page_Load(object sender, System.EventArgs e) {
        // Change the current path so that the Routing handler can correctly interpret
        // the request, then restore the original path so that the OutputCache module
        // can correctly process the response (if caching is enabled).

        string originalPath = Request.Path;
        HttpContext.Current.RewritePath(Request.ApplicationPath, false);
        IHttpHandler httpHandler = new MvcHttpHandler();
        httpHandler.ProcessRequest(HttpContext.Current);
        HttpContext.Current.RewritePath(originalPath, false);
    }

Also, another quicky is to hit CTRL-F5 (run without debugging) which will fire up the site without going into debug mode..

Alex DeLarge
Thanks so much. silverlight didn't debug right in any browser but IE, and now I can set my windows default to a browser that I like!
thepaulpage
A: 

The solution really is not that difficult, though it is not as direct as it ought to be...

In Visual Studio 2010, the Browse With option is available. However, it is not available for MVC Views!

Simply add a Web Form or HTML Page to your project, and Browse With is readily available in it's context menu. Here you can set the Default Browser, and that setting will be used for all subsequent debugging.

No need for complicated code in an Default.aspx page, or changing the Windows defaults.

Peter

related questions