Asp.Net MVC 301 Redirects

后端 未结 5 1062
无人共我
无人共我 2020-12-16 03:00

We used to use ISAPI Re-Write (Infact its still on our server) although it doesnt work with ASP.Net MVC (Somthing to do with \'euxd\' get param).

We need a relaiable

5条回答
  •  一向
    一向 (楼主)
    2020-12-16 03:37

    In MVC 3 there are three new redirect methods that can be used in controllers to redirect permanently (produce a 301); as opposed to the 302s (temporary redirect) produced by the MVC 2 redirects.

    • RedirectPermanent
    • RedirectToActionPermanent
    • RedirectToRoutePermanent
    public ActionResult OldAction()
    {
      return RedirectPermanent(urlname);
    }
    

    There is a great tutorial in the Controllers section of these walkthroughs on PluralSight.

提交回复
热议问题