This article is a mirror article of machine translation, please click here to jump to the original article.

View: 45642|Reply: 1

[ASP.NET] asp.net mvc does a 301 permanent redirect jump

[Copy link]
Posted on 6/20/2019 9:06:23 PM | | |

The following code is a 301 permanent redirect made by asp.net MVC 4.0 code

string url = “The hyperlink login is visible.

Response.StatusCode = 301;
Response.Status = "301 Moved Permanently";
Response.AppendHeader("Location", url));
Response.AppendHeader("Cache-Control", "no-cache");  An important setting here is no-cache, which means no local caching
Response.End();



In MVC 3, there are three new redirection methods that can be used in the controller for permanent redirection (generating 301); Instead of the 302s (temporary redirect) generated by MVC 2 redirects.







Previous:Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandT...
Next:C# listview control a cell color
 Landlord| Posted on 6/26/2021 11:22:20 AM |


Package 301 Jump Controller Method

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com