ASP.net MVC Membership Redirect Depending on Role -


I have two types of roles [Administrator, HelpDeskAdmin].

I have a logon view (both users go to the same link to login) and I want to check their role after logging once and after getting certified their related I want to redirect to the page. The user entering the role for the first time in the code given below is not identified for the first time in the role and the logon page reloads, the second time they redirect the logon correctly.

Is not a cookie if its authentication is checked for the first time? How can I complete this scenario? Public Action Result Logon (Logon Model Model, String Return URL) {if (ModelhipAervice.ValidateUser (model.UserName, model password)) {if (ModelState.IsValid) FormsService.SignIn (model.UserName, model.RememberMe); If (! String.IsNullOrEmpty (returnUrl)) {Redirect Return (returnUrl); } Else {if (roles.usuuser inner ("admin")) // // go to admin landing page redirectionctomy ("index", "management"); } And if the roles go to iSure Innerol ("Helpdesk") {// Helpdesk Landing Page Return Redirect Touched ("Index", "Interview"); } Other / ****** From the first time it always goes here ******* / Return Redirect Action ("Index", "Home"); // none of those roles}} and {ModelState.AddModelError ("", "The username or password provided is incorrect."); }} // If we got this far away, then some failed, see the form return view (model); }

User is not technically logged in until the next request is not controlled And the Firefox cookie is set ....

Either log in redirection in another action method or remove the user information by using riles. ISUser Inrol (model user, "admin") [< specify username ]] inside this action.


Comments