我正在使用ASP.net。我的網站託管在IIS根目錄下的子文件夾test
中。所以default.aspx的網址是http://localhost/test/Default.aspx
。從default.aspx,我想使用Reponse.Redirect()
與相對路徑重定向到另一個網址,在同一個網站,http://localhost/test/whatever
。使用Response.Redirect()到相對路徑
我試圖
Response.Redirect("/whatever");
和
Response.Redirect("~/whatever");
他們都重定向到http://localhost/whatever
。請注意,Redirect
方法使用http://localhost
而不是http://localhost/test/
作爲基礎URL。
任何想法?
謝謝。
我自己犯了一個愚蠢的錯誤。的Response.Redirect( 「〜/不管」);應該去http:// localhost/test/whatever。謝謝你們 。 – Shuo 2010-06-02 20:02:22