Authentication of forms for different roles?

I am developing a website on which I use authentication. We have 2 login pages: one for the user, another for the administrator.

I added this code to the webconfig file for the user.

<forms loginUrl="Login.aspx" defaultUrl="Home.aspx" > 

I use this code for the user when the user successfully logged in.

 FormsAuthentication.RedirectFromLoginPage (UserName.Text, chkPersistCookie.Checked) 

I do not use the default user membership database. I have my own database in SQL Server 2005.

I want the same for admin, but the default url is admin.aspx and the login url is adminlogin.aspx for admin.

How can I assign an administrator in a web configuration file? Is this right, or does anyone have a better concept for this?

+6
source share
2 answers

I used this line of code and it worked for me.

 FormsAuthentication.SetAuthCookie(txtUser.Text, true); Response.Redirect("Admin.aspx"); 
+6
source share

Entering administrator files in a folder and creating a web.config file in it is an option. Perhaps you can override the configuration rules there.

0
source share

All Articles