Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

application root path in web.config

Status
Not open for further replies.

aimlion11yahoo

Instructor
Jul 20, 2006
42
US
Is there a way to set the applications root path in the web.config?

Something like:

Code:
<add key="RootPath" value="~" />
 
I don't think so but do you really need to? Couldn't you use Server.MapPath from your page instead?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I cannot use Server.MapPath because where I need to use it is in a vb class, not in a .aspx page. Does that make sense?
 
Yes it does, but that's where the OO approach comes in. If you create a Property in your class and expose it by making it Public, then your Page can set the public property by using Server.MapPath.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Unfortunately, I should have said "classes" and "modules."
I was looking for someway to set it once like I did in the web.config. That way I could call it anyplace in the project. But now that the project will be running on a number of servers, I would have to create a appSettings for each site. This got to be a bit too much work, so I started looking for a better solution.

Lucky for me, all pages inherit a master page in which I can declare a public variable, then pass that variable to each of the routins where I need it.

Thanks, ca8MSM for your help.
 
Here is exactly what I was looking for: Finding the physical path of a web application from within a VB module.

Code:
Public Function GetAppPath() As String
  Return System.AppDomain.CurrentDomain.BaseDirectory()
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top