开发者

Account for simple url rewriting in ASP.NET MVC redirect

开发者 https://www.devze.com 2022-12-31 18:49 出处:网络
How would you go about redirecting in ASP.NET MVC to take into account some external URL rewriting rules.

How would you go about redirecting in ASP.NET MVC to take into account some external URL rewriting rules.

For example:

  • What the 开发者_StackOverflow社区user enters: http://www.example.com/app/route
  • What ASP.NET MVC sees: /route
  • What I want to redirect to: http://www.example.com/app/other_route
  • What actually happens when I do a simple RedirectToAction: http://www.example.com/other_route (which doesn't exist, from the outside anyway)

This seems like it should be simple, but I'm drawing a blank.


Just use

RedirectToAction("NewAction", "Controller-Required-If-Diferent-From-Current-Controller");

0

精彩评论

暂无评论...
验证码 换一张
取 消