Thursday, January 27, 2011

Get the Directory and Page Name

If you need to find the aspx page name (including the folder it's in, if applicable) use the AppRelativeCurrentExecutionFilePath property of the Http Request:
string filename=HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath;
This will return results like: ~/MyFolder/My.aspx   or ~/MyRootLevel.aspx

I found this at: http://www.west-wind.com/weblog/posts/132081.aspx

No comments:

Post a Comment