About FormsAuthentication.RedirectFromLoginPage(string username, bool createPersistentCookie)
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);
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); |
the statement above is equivalent to the following :
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
More about Forms authentication : http://www.gotdotnet.com/team/student/wintellect/aspnet_tutorial.aspx
posted on 2005-09-05 10:25 davidullua 阅读(1102) 评论(0) 编辑 收藏 举报