首页 > 编程语言 >C#路由器Demo

C#路由器Demo

时间:2022-10-28 18:15:08浏览次数:36  
标签:aa C# Demo controller action new Login id 路由器

 C#路由器Demo

//没有参数的路由控制器跳转
                new RedirectToRouteResult("Default", new RouteValueDictionary(new { controller = "SysAdmin", action = "Login" }));
                //有参数的路由控制器跳转
                new RedirectToRouteResult("Default", new RouteValueDictionary(new { controller = "SysAdmin", action = "Login", returnParamUrl = "http://www.baidu.com" }));

 

http://localhost:30893/?id=88

//-------------------------------------------

 filterContext.Result =
                new RedirectToRouteResult("JumpLogin", new RouteValueDictionary(new { controller = "ShopUsers", action = "Login", id = "88", aa = "33", ii = "99" }));

 

http://localhost:30893/?id=88&aa=33&ii=99

//------------------------------------------   

 filterContext.Result =
                new RedirectToRouteResult("Default", new RouteValueDictionary(new { controller = "ShopUsers", action = "Login", id = "88", aa = "33", ii = "99" }));

http://localhost:30893/ShopUsers/Login/88?aa=33&ii=99

//------------------------------------------   

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Shop", action = "Index", id = UrlParameter.Optional }
                //defaults: new { controller = "ShopUsers", action = "Login", id = UrlParameter.Optional }
            );

            //routes.MapRoute(
            //    name: "TestDemo",
            //    url: "{controller}/{action}/{aa}/{bb}",
            //    defaults: new { controller = "ShopUsers", action = "Login", aa = UrlParameter.Optional, bb = UrlParameter.Optional }
            //    );

            //routes.MapRoute(
            //    name: "JumpLogin",
            //    url: "{controller}/{action}",
            //    defaults: new { controller = "ShopUsers", action = "Login" }
            //    );

            //Route jumpRoute = new Route("{controller}/{action}", new MvcRouteHandler());
            //routes.Add("JumpLogin", jumpRoute);
        }

 

搜索

复制

标签:aa,C#,Demo,controller,action,new,Login,id,路由器
From: https://www.cnblogs.com/jankie1122/p/11108805.html

相关文章

  • HTML DOM contentDocument 属性
    https://www.jb51.net/w3school/htmldom/prop_iframe_contentDocument.htmcontentDocument属性能够以HTML对象来返回iframe中的文档。下面的例子可从载入iframe的......
  • 加解密EncryptUtils
    usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Security.Cryptography;usingSystem.Text;namespaceZB.Queue......
  • ubuntu学习5 more/less/head/tail/which/用户和组/useradd/useradel/usermod/groupadd
    more: 查看文件内容  more11.txtless :查看文件内容    less11.txthead:输出文件的开始的部分,可以指定行数,默认显示10行   head11.txth......
  • style.display='block' 有什么效果
    https://zhidao.baidu.com/question/305425072.htmlblock表示该元素显示为一个块级元素,单独占一行1、当表格为多列的情况下,属性为"display:block"行的内容宽度仅与第一列......
  • C# 鼠标帮助类
    usingSystem.Drawing;usingSystem.Runtime.InteropServices;usingSystem.Windows.Forms;namespaceZB.QueueSys.Common{publicclassMouseHelper{......
  • Codeforces Round #739 (Div. 3) E
    E.PolycarpandStringTransformation显然我们可以通过看谁消失的最早知道删除序列然后有了删除序列以后我们能干什么呢显然对于每一个删除序列我们要是第一次就把......
  • vue 中watch 回调函数和methos中方法的区别
    1.vue中代码<el-inputv-model="searchkey"placeholder="键名"@input="handleInput"clearablestyle="max-width:300px;"></el-/utils/commonwen文件加下export......
  • C# DataGridView Helper
    usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Drawing;usingSystem.Linq;usingSystem.Reflection;usingSystem.Te......
  • 工业网关BL110实现西门子S7-400 PLC 接入华为云平台
    LAN接口的配置COM口采集西门子S7-400PLC的配置工业智能网关BL110一共有一个LAN接口,一个WAN接口,可以通过LAN接口采集数据,通过WAN接口接入局域网,设置过程不一样,WAN接口可......
  • 工业网关BL110实现西门子S7-400 PLC 接入亚马逊云平台
    LAN接口的配置COM口采集西门子S7-400PLC的配置工业智能网关BL110一共有一个LAN接口,一个WAN接口,可以通过LAN接口采集数据,通过WAN接口接入局域网,设置过程不一样,WAN接口可......