ASP.NET Response.Redirect的使用,而不是302 301 [英] ASP.NET Response.Redirect uses 302 instead of 301
本文介绍了ASP.NET Response.Redirect的使用,而不是302 301的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用以下code
context.Response.StatusCode = 301;
context.Response.Redirect(newUrl, true);
context.Response.End();
我可以小提琴手看到它使用的是302而不是301我应该重定向调用后设置状态?
I can see in fiddler that it's using a 302 instead of a 301. Should I be setting the status after the redirect call?
推荐答案
如果您正在使用ASP.Net 4.0,可以使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.htt$p$psponse.redirectpermanent.aspx\">Response.RedirectPermanent,将使用301,而不是302。
If you're using ASP.Net 4.0, you can use Response.RedirectPermanent, which will use 301 instead of 302.
这篇关于ASP.NET Response.Redirect的使用,而不是302 301的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文