路由问题与MVC中的区域 [英] Routing Problem with areas in MVC

查看:137
本文介绍了路由问题与MVC中的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用MVC中的区域我的RouteConfig文件只有以下路线



Hi,

I am using the areas in MVC my RouteConfig file has only the following route

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
          var route = routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "User", action = "LogIn", id = UrlParameter.Optional },
              namespaces: new[] { "Srd.Controllers" }
          );
          route.DataTokens["area"] = "Users";





哪个重定向到用户区域默认情况下



我的问题出在视图中,我有以下操作显示错误。





Which is redirecting to "Users" area by default

my problem is in the view, I have the following action which is showing the error.

@Html.Action("SetPermissions", "SetSession", new { Area = "" });





路由表中的路由与提供的值不匹配。



任何帮助。



No route in the route table matches the supplied values.

Any help.

推荐答案

hi
你想使用patrial视图地址,返回partialview(SetPermissions地址)
hi you want use patrial view address into , return partialview("SetPermissions address")


这篇关于路由问题与MVC中的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆