后台取值+跳转


 public ActionResult Login(string name, string pwd)//传进来的字符串实际没用上
        {
            //取值//取值//取值//取值//取值//取值
            //至少有3种方法能够拿到前台Form表单submit提交过来的数据,必要条件:<input type="text" name="name"/>;;其中name是必要的
            //第一种:
            var name1 = Request["name"]; 或 +.ToString()
            //第二种::前提要Login( string name )
            var name2 = name;
            //第三种;
            var name3 = Request.Form[0];
            return View("Index");


            //跳转//跳转//跳转//跳转//跳转//跳转



     重要提示!::::当前台用ajax时,则跳转失败!!!原因:ajax开启另一新线程,跳转会发生,但是在ajax线程里,所以页面不会显示跳转!!!用form表单提交可解决此问题



            //转到当前Controller下action,,可以写 return RedirectToAction("Index");或 return RedirectToAction("Login");!!!!!!!!!!!!!!!!!!!!!!!!!!!
            //return RedirectToAction("Index");
            //转到Select_Controller下Index-action,
            //return RedirectToAction("Index", "Select_");
            //另一种跳转:路由跳转:
            //return RedirectToRoute(new { controller = "Home", action = "Index" });

            }

posted @ 2019-10-16 10:57  姜佳泉  阅读(161)  评论(0)    收藏  举报