How to 301 redirect in ASP.NET 4.0?

后端 未结 5 625
再見小時候
再見小時候 2020-12-16 15:59

I am trying to implement URL redirect for the website rather than doing it page by page. I want to do it in the global.asax file. Below is the code i have defined.

I

5条回答
  •  独厮守ぢ
    2020-12-16 16:15

    If using IIS 7 or higher, the simplest solution is to use the httpRedirect element in your web.config.

    
         
         
    
    

    This method is very powerful, for example if you have changed the domain but the pages are the same, you have just to add:

     
         
    
    

    I wrote a small article here: ASP.NET 301 permanent redirects: the best solution

提交回复
热议问题