Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
redirect from user login depending on rol
Posted
Comments
Ramug10 7-Mar-14 4:05am    
Have tried anything show me your code where you strucking????
Ankur\m/ 7-Mar-14 4:18am    
Whats is "rol"?

1 solution

Hi, If you are using aspnet membership you can try:

C#
//role home pages:
if (Roles.IsUserInRole(txtUsername.Text, "Role1"))
    Response.Redirect("~/System/Role1/Default.aspx");
else if (Roles.IsUserInRole(txtUsername.Text, "Role2"))
    Response.Redirect("~/System/Role2/Default.aspx");
else if (Roles.IsUserInRole(txtUsername.Text, "Role3"))
    Response.Redirect("~/System/Role3/Default.aspx");
else
    Response.Redirect("~/Default.aspx");
//the class 'Roles' is in the namespace: System.Web.Security
 
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