In this article i will describe how to redirect to a particular page according to role assigned to the user while login using C# and Asp.Net.
In the Previous articles i explained which namespace is used for membership class, how to insert record into access database using vb.net, how to update record into access database using vb.net, how to delete record from access database using vb.net, how to add namespace in vb.net and many more about ASP.Net.
Simply write the below code on LoggedIn event of Login Control
if (Roles.IsUserInRole(Login1.UserName, "admin"))
else if (Roles.IsUserInRole(Login1.UserName, "customer"))
As the Above Code is self explainatory.
Here if user is in role "admin" user will be redirected to "admin-dashboard.aspx" page. And if user is in role customer user will be redirected to "customer-dashboard.aspx" page.