Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have create to folder one is Admin and one is User with separete web.config file.

and in global.asax file i have done this code....
protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {
              if (HttpContext.Current.User != null)
        {
          cookie (ticket) exists for this user
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
               FormsAuthentication
                if (HttpContext.Current.User.Identity is FormsIdentity)
                {
                  
                    FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity;
                    FormsAuthenticationTicket ticket = identity.Ticket;
                    string[] roles = ticket.UserData.Split(',');
                    HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(identity, roles);
                }
            }
        }

but when i run the login page how can i check this page is for admin or user.

Plz tell me................
Posted
Updated 11-Jun-10 5:06am
v2

You don't need to check for user roles, asp.net will handle allowing/denying access if the settings in the web.config are correct.

http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900