摘自博客园

程晓晖

[HttpPost]
        public ActionResult StudentList( string StudName, string studName, DateTime BirthDay, FormCollection form, string controller, string Action, StudentModels student)
        {

//其中StudName为aspx页面中标签的name属性(StudName不区分大小写)
            //其中BirthDay为页面中标签的name属性(类型可自己指定【需转换成功才可以】,这里为DateTime)同样BirthDay不区分大小写
            //其中controller,Action为路由信息(controller,Action不区分大小写)
            //FormCollection包含了post回来的信息 通过form[]来取值
            //如果使用强类型绑定 可通过实体回传值 这里实体为StudentModels
            //同样可以使用Request.Form[] Request.QueryString[] Request[] 来取值 不过此Request非WebForm中的Request  这里的Request是RequestBase抽象类的实例 WebForm中Request是封装类 HttpRequest的实例
           
          
            #region 到要经过执行controller里方法后 显示出页面。 
            //return RedirectToAction("Index");//可跳出本controller
            //return RedirectToRoute(new {controller="Home",action="Index"});//可跳出本controller
            //Response.Redirect("Index");//只能使用本controller下的方法名称。返回值为void
            //return Redirect("Index");//只能使用本controller下的方法名称。
            #endregion

#region 直接显示出对应的页面 不经过执行controller的方法。
            //return View("Index");//非本方法
            //return  View("~/Views/Home/Index.aspx");//这种方法是写全路径
            #endregion
            return View();
        }

Asp.net Mvc Action重定向总结的更多相关文章

  1. ASP.Net MVC Action重定向跳出Controller和Area

    1.重定向方法简介 [HttpPost] public ActionResult StudentList( string StudName, string studName, DateTime Bir ...

  2. ASP.NET MVC : Action过滤器(Filtering)

    http://www.cnblogs.com/QLeelulu/archive/2008/03/21/1117092.html ASP.NET MVC : Action过滤器(Filtering) 相 ...

  3. ASP.NET MVC Action返回结果类型【转】

    ASP.NET MVC 目前一共提供了以下几种Action返回结果类型: 1.ActionResult(base) 2.ContentResult 3.EmptyResult 4.HttpUnauth ...

  4. HTTP Modules versus ASP.NET MVC Action Filters

    from:http://odetocode.com/blogs/scott/archive/2011/01/17/http-modules-versus-asp-net-mvc-action-filt ...

  5. ASP.NET MVC之"重定向/页面跳转"(关键词RedirectToAction,Redirect)

    MVC5 API(官方) 1.RedirectToRouteResult RedirectToAction(string actionName); RedirectToRouteResult Redi ...

  6. ASP.NET MVC Action向视图传值之匿名类型

    在使用ASP.NET MVC过程中想必大家都有遇到过一个问题就是我们的Action如何向视图传递匿名类型的值呢,如果不做特殊处理则无法实现. 接下来我们来看一个示例: 在我们的控制中: using S ...

  7. ASp.Net Mvc Core 重定向

    在之前老版本的MVC中.重定向直接写 HttpContext.Response.Redirect("/404.html") 就好了,程序走到这里会自动返回302然后跳转了, 但是这 ...

  8. Asp.Net Mvc Action过滤器(二)

    在Mvc中为Action添加过滤器,有两种方式, 一.使用ActionFilterAttribute,简单方式,同时支持Result的过滤处理, 1.可以为空,支持的重写:OnActionExecut ...

  9. Asp.net Mvc action返回多个模型实体给view

    1.controller中action代码: public class HomeController : Controller { public ActionResult Detail(int id) ...

随机推荐

  1. node官方docker镜像运行bower 提示 permission denied 解决方法

    在使用node官方docker镜像部署node应用时,应用需要npm的scripts中运行bower install 来安装前端包,但是用docker 构建时失败,提示 permission dein ...

  2. Callback, Promise和Async/Await的对比

    Callback, Promise和Async/Await的对比 Callback Hell getData1(function (data1) { console.log('我得到data1了') ...

  3. vue-elem-stylus 的mixin用法

    .tab border-1px{red} minxin border-1px(&color) position:relative &::after display:block posi ...

  4. Life here can be a dream come true!

    Life here can be a dream come true!美梦迟早会成真的!

  5. [转]ubuntu16.04安装teamviewer12依赖包解决

    安装teamviewer下载地址:http://www.teamviewer.com/en/download/linux/ 下载的是:teamviewer_12.0.76279_i386.deb   ...

  6. scanner/portscan/syn

    msf > use auxiliary/scanner/portscan/syn msf auxiliary(syn) > set RHOSTS 172.16.21.170  /*设定rh ...

  7. DB2数据库备份还原

    恢复及备份NC DB2数据库步 一. 安装DB2数据库 解压db2v9.5ins.rar安装,在写此文档时客户一般用的是9.5: 注意不要将db2安装到系统盘: 二. Windows版本 1.数据库备 ...

  8. 更改placeholder样式

    /*不要将选择器进行组合*/ /* IE 10-11 */ :-ms-input-placeholder { color: #aaa; } /* webkit */ ::-webkit-input-p ...

  9. Visual Studio 2015简体中文版

    Visual Studio  2015简体中文版(企业版) http://download.microsoft.com/download/B/8/F/B8F1470D-2396-4E7A-83F5-A ...

  10. Win 10 Google 云端硬盘 网页证书问题导致无法登录解决办法

    操作方法 按照图示,将以下3项勾去并确定. 效果 设置以后,可成功访问: