Difficulty in managing URL Paths
Question
Managing url paths can be a real pain in ASP.NET. AbsolutePath vs RelativePath vs etc. drives me crazy. I find that many solutions require the user to edit web.config element to include the correct subfolder path; ex.
Website Root: http://www.domain.com Web.config setting: /
Website Root: http://www.domain.com/blog web.config setting: /blog/
Is there a way to properly handle this without having to make changes to the web.config?
Solution
You could use Request.ApplicationPath. A reference of usage is here.
This way your images folder, for example, will be Request.ApplicationPath + "/images/";
OTHER TIPS
I think Rick's blog entry helps solve some of my problems...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow