【发布时间】:2012-11-03 21:41:43
【问题描述】:
我正在尝试将 Custom Forms Authentication 应用到我已经应用 Url Rewriting 的网站。
在global.asax 文件中的Application_Start 中使用此代码。
routes.MapPageRoute("bill-details", //Route Name
"{billno}", //URL with Parameters
"~/CallCenter/BillDetails.aspx" //Webforms page to Handle it.
);
但是当我尝试重写 Loginpage Url 时,我无法重写它。
<forms loginUrl="/Login.aspx" name="MyCustomAuthentication" timeout="30"/>
实际问题是,当我打开一个页面时,它会检查身份验证,如果未通过身份验证,则它会重定向到 Login.aspx 页面。
它显示为mywebsite.com/Login.aspx?ReturnUrl="..."
我无法重写这个。如果我无法删除返回 URL,那么我可以放置 Login 而不是 Login.aspx??
如果我使用这篇文章中的代码 -> How to remove returnurl from url?
如果我使用它,那么控制会一遍又一遍地循环并显示 - 重定向太多。我认为问题是,当控件像mywebsite.com/Login 一样转到Login 页面时,它会检查身份验证并重定向到Login.aspx 页面。并且您的代码再次重定向到登录页面。这个循环继续。
我也不需要返回网址,因为我的用户必须先登录才能访问我的网站。
那么你能帮我删除返回网址吗?还有在 URL 重写中??
我无法解决这个问题!
检查我的网站。 -> http://orders.maabookings.com
UserId - temp Password - temp
在这个登录页面中,它显示为
http://orders.maabookings.com/Login.aspx?ReturnUrl=%2f
我需要这个是http://orders.maabookings.com/Login
我该怎么做??
【问题讨论】:
-
恐怕您无法删除 ReturnUrl,它是 Forms Auth 提供程序的一部分。
-
这个问题我不清楚。 “我无法重写它”是什么意思?实际的错误或行为是什么?
-
我改变了我的问题。你现在清楚了吗?
标签: c# asp.net url-rewriting forms-authentication