我在這裏下面的代碼http://www.4guysfromrolla.com/articles/072810-1.aspxASP.NET網站重定向幫助
重定向到http://somesite.comhttp://www.somesite.com
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Url.Authority.StartsWith("www"))
return;
var url = string.Format("{0}://www.{1}{2}",
Request.Url.Scheme,
Request.Url.Authority,
Request.Url.PathAndQuery);
Response.RedirectPermanent(url, true);
}
如何使用這個代碼來處理的情況下http://abc.somesite.com應該重定向到www.somesite .com
我沒有訪問DNS的權限。我也沒有提到價值。我只需要http://somevalue.somesite.com重定向到www.somsite.com。你能提供一些代碼嗎? – 2011-05-11 19:05:09