I need to know the path for Request.AppRelativeCurrentExecutionFilePath. It gives the wrong file path when i retrieve any requests.
views:
262answers:
1
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
2008-12-15 12:50:52
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
2009-08-21 06:56:13