求解,ASP.Net MVC Redirect 无法跳转问题

①JS代码

 1 $.post("/Home/CheckLogin", { "username": $("#username").val(), "password": $("#password").val(), "role": $("#roleSelect").val() }, function (returnString) {
 2                     if (returnString == "Error1") {
 3                         $("#password").val() = "";
 4                         alert("用户名或者密码错误!");
 5                     } else if (returnString == "Error2") {
 6                         alert("该用户被禁用,请与管理员联系!");
 7                     } else if (returnString == "Error3") {
 8                         alert("登录异常,请重试!");
 9                     }
10                     else {
11                         alert(returnString);
12                     }
13                 });

 

②C#代码(登录验证成功之后应该跳转用户界面)

1  if(result == "Success")
2                     {
3                         //登录验证成功,写session,返回用户视图
4                         Session["Role"] = "Student";
5                         Session["UserNum"] = username;
6                         //return RedirectToAction("StudentInfo");
7                         return Redirect("StudentInfo");
8                     }

 

③结果

posted @ 2015-08-27 10:09  蜗牛噢  阅读(1754)  评论(1编辑  收藏  举报