- XML code
<authentication mode="Forms"> <forms loginUrl="~/Login.aspx" timeout="2880" defaultUrl="~/Index.aspx"/> </authentication>
已经在config文件中配置了Form验证。默认的URL是Index.aspx,当登录成功后会跳转到Index.aspx
但我想要的想过是:Login成功后,跳转到它之前访问的页面。
- VB.NET code
Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs) If Membership.ValidateUser(LoginUser.UserName, LoginUser.Password) Then FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, True) End If End Sub
但它总是跳转到Index.aspx
------解决方案--------------------
之前的网页是不是这个项目下的?
总得有记录的session或者cookie 吧