Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have created a page which have login controls.
when user type username and password store procedure authenticate user and web.config file navigate user to default page.
m using form authenticate mode.


how i can create a two login controls according to priveleges of user and after successfull login
redirect admin to admin.aspx page and normal user to normal.apsx page using web.config setting.
Posted

1 solution

go to events of login control and add event LoggedIn, in the event code you could done something like below

C#
protected void Login1_LoggedIn(object sender, EventArgs e)
{
    if (Roles.IsUserInRole(Login1.UserName, "Admin"))
        Response.Redirect("~/Admin.aspx");
    else if (Roles.IsUserInRole(Login1.UserName, "User"))
        Response.Redirect("~/Normal.aspx");
}
 
Share this answer
 
Comments
Tarun Jaiswal 10-May-14 9:27am    
NO i dnt what this type of coding work because when user login his password get hashed into "SHA1" algorithm by web.config then its get valid from my database which already store password in hashed format
DamithSL 10-May-14 9:58am    
there is no relationship in above code with password!
only the user role, haven't you check the code?

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