Last post Feb 25, 2014 02:49 AM by Shawn - MSFT
Feb 22, 2014 06:19 AM|kashifdotnet|LINK
I am developing a site which uses FormsAuthentication. I am not using the built-in asp.net Membership feature. The <authentication mode is set to forms> in the web.config file. Roles are also defined in the Global.asax file. On the login page, this is code
if (user is authenticated)
FormAuthenticationTicket t = New FormsAuthenticationTicket (...);
string hash = FormAuthentication.Encrypt (t);
HttpCookie myCookie = new HttpCookie (FormsAuthentication.FormsCookieName, hash);
string url = Request.QueryString ["returnURL"];
// display error message
I just want to know if the above code is the correct way to use FormAuthentication. Please correct me if I am mistaken. Thanks...
Feb 22, 2014 08:45 AM|BrockAllen|LINK
Just use FormsAuthentication.SetAuthCookie or FormsAuthentication.RedirectFromLoginPage instead.
Feb 25, 2014 02:49 AM|Shawn - MSFT|LINK
These Roles and Membership classes come in very handy when we want to provide authentication and authorization in our applications. About using ASP.NET Roles and Membership classes to provide authentication and authorization in our applications, you could
However, we might still find ourselves in situations where we need to have our own database for tracking users and their roles. So, we need to use ASP.NET Forms Authentication but according to our database schema and our custom written code to handle user
management. For understanding and Implementing ASP.NET Custom Forms Authentication: