tags:

views:

262

answers:

1

I need to know the path for Request.AppRelativeCurrentExecutionFilePath. It gives the wrong file path when i retrieve any requests.

A: 

it gets the virtual path of the application root and makes it relative by using the tilde (~) notation for the application root.

so if your application is hosted at http://localhost/WebApp1 and you want to access Picture1.jpg in the root directory, using that will return ~/Picture1.jpg

string _directoryName = Request.AppRelativeCurrentExecutionFilePath + "Picture1.jpg" will return http://localhost/WebApp1/Picture1.jpg

FailBoy
This is incorrect - it's the virtual path of the *currently executing file* - not the application root itself. So your example won't work at all because it will resolve _directoryName to something like "~/default.aspxPicture1.jpg".
Michael Hart