Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net After a Server.Transfer how do you get the path of the current page?

Tags:

asp.net

To get the url of the current page, I usually do something like this:

string path = Request.Path;

If I do this after a Server.Transfer then I get the path of the page where the transfer was done. How can I get it for the current page?

For example:

On Page1.aspx I do Server.Transfer ("Page2.aspx")
On Page2.aspx Request.Path returns /Page1.aspx and not /Page2.aspx

I would like to get /Page2.aspx. How can I get it?

like image 995
Anthony Avatar asked Jan 10 '10 14:01

Anthony


People also ask

What is difference between Server transfer and response redirect?

The Response. Redirect method redirects a request to a new URL and specifies the new URL while the Server. Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

Which method is used to terminate execution of the current page and starts execution of a new page using the specified URL of the page?

Transfer(String, Boolean) Terminates execution of the current page and starts execution of a new page by using the specified URL path of the page.

What is a Server transfer?

Server data transfer (SDT) is a server-side delivery method for transferring user data from the Oracle Data Cloud platform into your system. After an ID swap has been performed on a user, the platform can deliver data on that user to your server-side profile store — without firing a pixel.

What is usage of Server transfer?

Server. Transfer() should be used when: we want to transfer current page request to another . aspx page on the same server. we want to preserve server resources and avoid the unnecessary roundtrips to the server.


1 Answers

You're looking for the Request.CurrentExecutionFilePath property.

like image 115
SLaks Avatar answered Nov 15 '22 18:11

SLaks