且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IIS - ASP.NET MVC重定向

更新时间:2022-04-05 22:50:39

是啊,这最后一点是一个真正的警告。如果这是在IIS7,它会更容易100%!

Yeah, that last bit is a real caveat. If this were on IIS7, it'd be 100% easier!

您可以下载其他应用程序做重定向的工作,但那就不是很难编辑MVC应用程序。假设/问题/和/质量/是不同的路线,为什么不这样做的:

You could download another app to do the redirecting work, but then it wouldn't be hard to edit the MVC app. Assuming that /issue/ and /quality/ are different routes, why not just do something like this:

public class MyController
{
  public RedirectResult Issue()
  {
    //return as a redirect
    return Redirect("http://applicationb/issue");
  }

  public ActionResult Quality()
  {
    //This is here to show that, instead of redirecting, it returns a view.
    return View();
  }
}