我正在开发一个Web应用程序并尝试为所有表单添加身份验证。
最初我尝试了这个,并在成功登录后在我的default.aspx页面上工作:
Session["username"] = username;
Response.Redirect("/Home.aspx");
之后我尝试在web.config中添加身份验证,这是配置
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Default.aspx" protection="All" timeout="2880" path="/" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
和代码(default.aspx)
string strRedirect = Request["ReturnUrl"];
Response.Redirect(strRedirect);
我看到ReturnURI字符串没问题(/Home.aspx)
但它没有重定向到Home.aspx页面,不确定是什么问题!我怀疑这里有一些路径错误!
由于