①js Code
1$.post ("/home/checklogin", {"username": $ ("#username"). Val (), "Password": $ ("#password"). Val (), "Role": $ ("# Roleselect "). Val ()},function(returnstring) {2 if(returnstring = = "Error1") {3$ ("#password"). val () = "";4Alert ("User name or password is wrong!") ");5}Else if(returnstring = = "Error2") {6Alert ("The user is disabled, please contact the Administrator!") ");7}Else if(returnstring = = "Error3") {8Alert ("Login exception, please try again!") ");9 }Ten Else { One alert (returnstring); A } -});
②c# code (should jump to user interface after successful login verification)
1 if(Result = ="Success")2 {3 //Login Verification successful, write session, return to user view4session["Role"] ="Student";5session["Usernum"] =username;6 //return redirecttoaction ("Studentinfo");7 returnRedirect ("Studentinfo");8}
③ Results
Solve, ASP. NET MVC Redirect cannot jump problem