zoukankan      html  css  js  c++  java
  • c# mvc action 跳转方式

    前言

    c# 的mvc 有很多的action跳转方式,在此总结一下具体的跳转方法。

    这里不用去记,而是知道能怎么做,为什么能这样做,重在思考。

    正文

    一、RedirectToAction("Index");//一个参数时在本Controller下,不传入参数。
    
    二、RedirectToAction(ActionName,ControllerName) //可以直接跳到别的Controller.
    
    三、RedirectToRoute(new {controller="Home",action="Index"});//可跳到其他controller
    
    四、RedirectToRoute(new {controller="Home",action="Index", id=param});//可跳到其他controller,带参数。
    
    五、Response.Redirect("Index?id=1");//适用于本controller下的方法名称,可带参数。
    
    六、return Redirect("Index");//适用于本controller下的方法名称。
    
    七、return View("Index"); //直接显示对应的页面 不经过执行Controller的方法。
    
    八、return View("~/Views/Home/Index.aspx");//这种方法是写全路径,直接显示页面,不经过Controller方法
    
    九、return View();//直接显示页面,不经过Controller方法
    
  • 相关阅读:
    特征的处理
    Pandas读取文件
    标准化数据-StandardScaler
    hibernate 继承映射
    hibernate 多对多关联映射
    hibernate 一对一关联映射
    hibernate 一对多 单双向关联
    hibernate配置文件
    spring整合struts2
    AWS云教育账号创建以及搭建数据库
  • 原文地址:https://www.cnblogs.com/aoximin/p/13036180.html
Copyright © 2011-2022 走看看