About FormsAuthentication.RedirectFromLoginPage(string username, bool createPersistentCookie)
2005-09-05 10:25
721 查看
FormsAuthentication.RedirectFromLoginPage(string username, bool createPersistentCookie) is used in Froms Authenticaiton in ASP.Net application. Forms authentication, in fact is an authentication based on auth cookies, if a cookie of the Forms name which specified in Web.config file exists in client computer, the user is authenticated, else is unauthorized.
the following code create a Forms authentication Cookie, and Set authentication cookie, then redirect to originally requested URL, if requested URL does not exist, it would redirect to default.aspx by default. username: Name of the user for cookie authentication purposes. the second parm createPersistentCookie determines whether the authentication cookie is persisitent, if it is false, cookie would be expired upon closing of the browser.
the statement above is equivalent to the following :
FormsAuthentication.SetAuthCookie(UserName.Text,mycheckbox.Checked);
Response.Redirect(FormsAuthentication.GetRedirectUrl(UserName.Text,mycheckbox.Checked);
More about Forms authentication : http://www.gotdotnet.com/team/student/wintellect/aspnet_tutorial.aspx
the following code create a Forms authentication Cookie, and Set authentication cookie, then redirect to originally requested URL, if requested URL does not exist, it would redirect to default.aspx by default. username: Name of the user for cookie authentication purposes. the second parm createPersistentCookie determines whether the authentication cookie is persisitent, if it is false, cookie would be expired upon closing of the browser.
FormsAuthentication.RedirectFromLoginPage (UserName.Text, false); |
FormsAuthentication.SetAuthCookie(UserName.Text,mycheckbox.Checked);
Response.Redirect(FormsAuthentication.GetRedirectUrl(UserName.Text,mycheckbox.Checked);
More about Forms authentication : http://www.gotdotnet.com/team/student/wintellect/aspnet_tutorial.aspx
相关文章推荐
- 关于FormsAuthentication.RedirectFromLoginPage() context.user.Identity.name
- FormsAuthentication.RedirectFromLoginPage Method (String, Boolean)
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- FormsAuthentication.RedirectFromLoginPage Method (String, Boolean)
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket
- FormsAuthentication.RedirectFromLoginPage
- FormsAuthentication.RedirectFromLoginPage
- 关于FormsAuthentication.RedirectFromLoginPage()
- FormsAuthentication.RedirectFromLoginPage 登录
- form身份验证通过后,只能用FormsAuthentication.RedirectFromLoginPage
- 关于FormsAuthentication.RedirectFromLoginPage()
- FormsAuthentication.RedirectFromLoginPage 登录
- string path = FormsAuthentication.GetRedirectUrl(User.Identity.Name, false);
- FormsAuthentication.RedirectFromLoginPage 登录
- FormsAuthentication.RedirectFromLoginPage 登录
- form身份验证通过后,只能用FormsAuthentication.RedirectFromLoginPage
- FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(u.UserName, false);
- create sqlserver login user and add it to certain db user (sqlserver authentication)