Hi I am programming in C# and building a website. I am trying to use AppSettings in the web config to set paths to image folders so that I can use those AppSettings anywhere in the site to sort of use as a shortcut to the image folders. I can not figure out how to get the main root of the website so that I can just call this from any folder and get the right path.
Asked
Active
Viewed 248 times
2
-
4You can resolve the root url like this: http://stackoverflow.com/questions/3077558/use-of-tilde-in-asp-net-path – TGH Apr 23 '13 at 04:19
-
post this as an answer this worked!! @TGH – Robert Zeno Apr 23 '13 at 04:22
-
You can refer this link http://stackoverflow.com/questions/5542610/access-folders-in-root-directory – Kiranramchandran Apr 23 '13 at 04:37
2 Answers
2
This also returns the root:
<img src="~/apps/thisapp/images/logo.gif" alt="" runat="server" />
Or
Server.MapPath("~")

highwingers
- 1,649
- 4
- 21
- 39