Home > Net >  The Core ASP.NET MVC two problems, a great god
The Core ASP.NET MVC two problems, a great god

Time:10-06

1, how to get the current in the filter effect of view path, such as "/home/index. The CSHTML" or "/share/index. The CSHTML",
Or in the view component gets the current view of path,

2, how to modify the current Response of in filtration (such as inserting a piece of code, in front of and stern append the can use the Response of the page. The WriteAsync), and eventually to modify the output page

CodePudding user response:

RouteData. Route. GetRouteData (this. HttpContext) Values (" controller ")
RouteData. Route. GetRouteData (this. HttpContext) Values (" action ")
Or
RouteData. Values (" controller ")
RouteData. Values (" action ")

CodePudding user response:

reference 1st floor tangyanzhi1111 response:
RouteData. The Route. The GetRouteData (this. HttpContext.) Values (" controller ")
RouteData. Route. GetRouteData (this. HttpContext) Values (" action ")
Or
RouteData. Values (" controller ")
RouteData. Values (" action ")


Is usually the result like this, but when you use the share View templates, or specify a View Template name, such as the return View (" Template "), the result is not correct
  • Related