加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-2 – 在Visual Studio 2010 RC中更改默认浏览器

发布时间:2020-12-15 18:48:41 所属栏目:asp.Net 来源:网络整理
导读:在Visual Studio 2010(RC)中,右键单击.aspx页面后,不再有“浏览”上下文菜单。现在如何更改默认浏览器? 默认情况下,它似乎使用操作系统默认浏览器,但我宁愿在调试ASP.net应用程序时使用IE。 (我正在用ASP.net MVC测试这个) 解决方法 在MVC项目的.aspx视
在Visual Studio 2010(RC)中,右键单击.aspx页面后,不再有“浏览”上下文菜单。现在如何更改默认浏览器?

默认情况下,它似乎使用操作系统默认浏览器,但我宁愿在调试ASP.net应用程序时使用IE。 (我正在用ASP.net MVC测试这个)

解决方法

在MVC项目的.aspx视图中没有“浏览”选项,因为它们不是直接可浏览的。

我倾向于做的是在Site的根目录中添加一个Default.aspx webform,当右键单击它将给你浏览选项。您需要确保更新您的路由,否则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(不运行调试),这将启动网站,而不进入调试模式。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读