2012-05-18 32 views
-2

我使用的URL重定向在ASP.net喜歡本頁如何獲得URL呼叫在URL重定向

http://xyz:6477/BoxOffice/Events/353454 

重定向到>>>

http://xyz:6477/BoxOffice/Events.aspx?EventId=353454 

我想在頁面加載網址活動頁面的

http://xyz:6477/BoxOffice/Events/353454 
+0

HttpRequest.UrlReferrer物業http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx – JamieSee

回答

-2

使用

//To get referrer 
//in C# 
Uri MyUrl = Request.UrlReferrer; 

//in vb 
Dim MyUrl As Uri = Request.UrlReferrer 

//To get current 
//in C# 

Uri currrenturl = Request.Url; 
//in vb 
Dim currentUrl As Uri = Request.Url 

如果使用路由然後用

//c# 
    string ref = Request.UrlReferrer.LocalPath; 
+0

UrlReferrer給我以前的調用頁面的URL不是這個URL –

+0

你想要當前頁面的url嗎? –

+0

我想要當前頁面的Url但沒有重定向我想要這個http:// xyz:6477/BoxOffice/Events/353454 –