2010-11-08 25 views
1

我有一個在ASP.NET環境中託管的網站。該網站目前能夠處理.aspx請求。如果用戶請求服務器中不存在的.aspx頁面,那麼我可以將他/她重定向到一般錯誤頁面。如何處理ASP.NET網站中的ASP請求?

現在的問題是,如果用戶發出請求的.asp頁, 例如,如果用戶鍵入

http://wwww.example.com/index.asp

然後錯誤處理程序不起作用。我想他/她重定向這裏,

http://wwww.example.com/index.aspx

我怎樣才能做到這一點?

在此先感謝。

回答

2

對於permanent redirect

Response.Status="301 Moved Permanently" 
Response.AddHeader "Location","http://www.new-url.com/" 

OR this

Response.Redirect "http://www.new-url.com/" 
+0

對不起,不是具體的。我編輯了這個問題。你能再請回答嗎? – Sohel 2010-11-09 09:50:38