关于FormsAuthentication.RedirectFromLoginPage() context.user.Identity.name
2012-03-31 17:18
579 查看
看别人的代码,发现下面一句
FormsAuthentication.RedirectFromLoginPage(userId, false);
能重定向至另一页面,但这里并没有指定要转向那个页面啊,
原来在web.config有配置啊
<authentication mode="Forms" >
<forms loginUrl="login.aspx"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
呵呵,这个东西很爽的,当用了FORM认证,如果你没有登录,不管你打开的哪页,都会进入指定的登录页面,登录完成后,又能返回你指定的页...
authentication mode="Forms" > <forms loginUrl="login.aspx"></forms>
</authentication>
-----------------------------上面是身份验证的
-----------------下面是授权的
<authorization>
<deny users="?"/>
</authorization>
将已验证身份的用户重定向回最初请求的 URL
为什么context.user.Identity.name总是为空??
建立一个IHttpModule并且在web.config注册它。
然后在Cookies或Session里记录了用户的标记,
在每次的Application.AxxxxxRequest(英文不知怎写,验证请求)时,根据Cookies,Session的信息重新做一次context.user=new Myprincipal(userId);
相关文章推荐
- About FormsAuthentication.RedirectFromLoginPage(string username, bool createPersistentCookie)
- 关于FormsAuthentication.RedirectFromLoginPage()
- 关于FormsAuthentication.RedirectFromLoginPage()
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- form身份验证通过后,只能用FormsAuthentication.RedirectFromLoginPage
- FormsAuthentication.RedirectFromLoginPage 登录
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- FormsAuthentication.RedirectFromLoginPage
- form身份验证通过后,只能用FormsAuthentication.RedirectFromLoginPage
- FormsAuthentication.RedirectFromLoginPage Method (String, Boolean)
- string path = FormsAuthentication.GetRedirectUrl(User.Identity.Name, false);
- FormsAuthentication.RedirectFromLoginPage 登录
- FormsAuthentication.RedirectFromLoginPage 登录
- FormsAuthentication.RedirectFromLoginPage
- FormsAuthentication.RedirectFromLoginPage Method (String, Boolean)
- FormsAuthentication.RedirectFromLoginPage 登录
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- 集成平台自动登入+C# Login控件,造成的HttpContext.Current.User.Identity.Name 为空问题解决方案
- RedirectFromLoginPage是封装了传登录信息