Wish for all DP user ! I have a login template in asp.net Now i want to check if the user is part of the admin role to go the admin/default.aspx if he is part of the users role then go to user/welcome.aspx. How to do this. I am using coding as follows: protected void Login2_Authenticate1(object sender, AuthenticateEventArgs e) { if (User.IsInRole("Administrator")) { Response.Redirect("admin/default.aspx"); } else if (User.IsInRole("free membership")) { Response.Redirect("user/welcome.aspx"); } } Note : i have also tried same coding for Login_LoggedIn events also . Thanks is advance all DP user.
I cant see a problem with your code, are you getting an error from the code that you've posted? If User.IsInRole("Admin") Then 'Redirect End If ^^ Should work fine.
try following code ASPX <asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn"> PHP: CS protected void Login1_LoggedIn(object sender, EventArgs e) { if (Roles.IsUserInRole(Login1.UserName, "admin")) { Response.Redirect( "~/admin/default.aspx"); } else if (Roles.IsUserInRole(Login1.UserName, "free membership")) { Response.Redirect("~/user/Welcome.aspx"); } else { Response.Redirect("~/Error.aspx"); } } PHP:
Thanks dear ! But now I am using other method for this task . I will aslo try your suggested method. Thanks for help & giving your coslty time.