博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
(转)ASP.NET MVC VS2010中更改默认调试浏览器
阅读量:7057 次
发布时间:2019-06-28

本文共 1694 字,大约阅读时间需要 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)

在Visual Studio 2010(RC)中右键点击 .aspx 页面已不复存在"browse with"菜单项。那要如何修改调试时使用的默认浏览器呢?

默认情况下,VS会使用操作系统的默认浏览器,但我在调试 ASP.NET 程序时更偏向于使用IE浏览器。(我是测试的是ASP.NET MVC2的网站)

 

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

MVC 工程中的 .aspx 视图没有"Browse With"菜单项是因为它禁止被直接浏览。

我的做法是(2步都要做完啊)

第一步:在网站的根目录下添加一个名为"Default.aspx"的 webform 视图,右键点击它就会看到"浏览方式"选项。

第二步:你需要确认更新你的路由使IIS/Cassini 能够使之运转,在Default.aspx的cs里面写上下面这句,不然会出现错误()

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);   //这句我注释掉了,因为会不去掉的话好像会出现 错误信息()然后显示在下面,MVC主页还是会出来    }

转载地址:http://qngol.baihongyu.com/

你可能感兴趣的文章
2千五主机
查看>>
Ehcache学习笔记(二) 根据条件筛选缓存中的数据
查看>>
逻辑数据库设计 - 乱穿马路(多对多关系)
查看>>
Analysis Service Tabular Model #002 Analysis services 的结构:一种产品 两个模型
查看>>
PostgreSQL 的 pl/pgsql 的 cannot begin/end transactions in PL/pgSQL错误
查看>>
多线程编程之三——线程间通讯
查看>>
vs快捷键
查看>>
Oracle DBA常用查询
查看>>
修复Telerik reporting 在网页中使用时的样式
查看>>
Hackers’ Crackdown-----UVA11825-----DP+状态压缩
查看>>
Waiting Processed Cancelable ShowDialog
查看>>
[leetcode]Spiral Matrix
查看>>
hdu 1232 畅通工程(并查集)
查看>>
在github上写个人简历——先弄个主页
查看>>
用jquery实现遮罩层
查看>>
POJ 2229 Sumsets(技巧题, 背包变形)
查看>>
啥时候js单元测试变的重要起来?
查看>>
使用strtotime和mktime时参数为0时返回1999-11-30的时间戳问题
查看>>
php mysql 扩展安装
查看>>
Thrift架构~目录
查看>>