Asp.net-Mvc-2

在 Visual Studio 2010 RC 中更改預設瀏覽器

  • March 14, 2010

在 Visual Studio 2010 (RC) 中,右鍵點擊 .aspx 頁面時不再有“瀏覽方式”上下文菜單。您現在如何更改預設瀏覽器?

預設情況下,它似乎使用作業系統預設瀏覽器,但在調試 ASP.net 應用程序時我更喜歡使用 IE。(我正在使用 ASP.net MVC 2 對此進行測試)

MVC 項目中的 .aspx 視圖上沒有“瀏覽方式”選項,因為它們並不意味著可以直接瀏覽。

我傾向於在站點的根目錄中添加一個 Default.aspx 網路表單,當右鍵點擊時,它將為您提供“瀏覽方式”選項。您需要確保更新您的路由,否則 IIS/Cassini 將嘗試提供它,就像這樣

  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);
   }

另外,另一個快捷方式是按 CTRL-F5(不調試就執行),這將在不進入調試模式的情況下啟動站點。

這是我唯一的工作方式: 如何在 VS2010 RC 中設置我的開發 Web 瀏覽器?

還有一個適用於 Visual Studio 的瀏覽器切換器擴展,效果很好! <http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921> 瀏覽器切換器

更新: 擴展從圖庫中刪除,試試這個:http: //visualstudiogallery.msdn.microsoft.com/233945ae-0b7b-47e7-9b02-c5a11798afb5

預設瀏覽器更換器

引用自:https://stackoverflow.com/questions/2443749