Change default browser in Visual Studio 2010 RC

给你一囗甜甜゛ 提交于 2019-12-18 12:47:47

问题


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)


回答1:


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




回答2:


this is the only working way for me: How do I set my development web browser in VS2010 RC?

There is also a browser switcher extension for Visual Studio, which works perfectly! http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921

update: the extension is removed from the gallery, try this one: http://visualstudiogallery.msdn.microsoft.com/233945ae-0b7b-47e7-9b02-c5a11798afb5




回答3:


this browser switching extension is what i use. It's pretty awesome.

EDIT: Possible new link




回答4:


I just added a .htm page and right clicked on it. There I had Browse With...




回答5:


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.




回答6:


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".




回答7:


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.




回答8:


"Browse With.." is available on VS2010. Left Click the empty space of top panel -> select "Web Browser". Right click .aspx, "Browse With.." is accessible now.




回答9:


Go to :

C:\Users\[Your current user]\AppData\Local\Microsoft\VisualStudio\10.0\browsers.xml

clear all contents and save ------if your default browser at the windows is IE new settings change to IE ----- Compile your application




回答10:


another way (and more easy) that we can do this is: open the browser that you want, for example, IE and going in Tools > Options > Programs > and click the button like "Set Default Browser"



来源:https://stackoverflow.com/questions/2443749/change-default-browser-in-visual-studio-2010-rc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!