您的位置:首页 > 编程语言 > ASP

一例ASP.net 网站‘此网页包含重定向循环’解决方法

2015-04-21 10:26 363 查看
今天遇到一个奇怪问题;

某网站,使用VS自带的ASP.NET Development server启动没有问题。但是用IIS Express启动以后无法访问。

使用IE查看网站查不出什么问题,使用chrome报告错误‘此网页包含重定向循环’。

看来是代码什么地方弄错了,查查代码,登录页面有这样一段;

protected void Page_Load(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
string tttt = Request.QueryString["ReturnUrl"];
if (tttt != "/luozhuang/Default.aspx")
{
Response.Redirect("../Default.aspx", true);
}
看来问题出在访问路径被写死了。因为IIS Express默认使用的根是/,而ASP.NET Development server设置的根是/luozhuang。

解决方法就是在IIS Express进行设置;

</site>
<site name="bsim" id="2048214810">
<application path="/" applicationPool="Clr2IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\luozhuang" />
</application>
<application path="/luozhuang" applicationPool="Clr2IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\luozhuang" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:15792:localhost" />
</bindings>
</site>
然后使用http://localhost:15792/luozhuang 去访问就好了,哎这些程序猿也是让人无语了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐