Server.MapPath in .NET

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

How do you say Server.MapPath in the web config file .NET. I am trying to
put an entry in the web config file which points to the current bin
directory where my database resides.

Thank You for any help with this!
 
Hi,

You can use Request.PhysicalApplicationPath and append with 'bin' to get the
physical path to the app bin folder instead of hardcoding the path in the
config file.

HTH.

How do you say Server.MapPath in the web config file .NET. I am trying to
put an entry in the web config file which points to the current bin
directory where my database resides.

Thank You for any help with this!
 
I guess what I am asking: is it possible to dynamically change the
web.config file depending on the which server it resides on or is the
web.config static?
 
Oops, sorry about that :-(

Since web.config file is nothing but a valid XML file, use System.Xml types
to manipulate the sections. An example could be found here:
http://www.abstractvb.com/code.asp?A=1093

Hope this is what you are lookin for.

I guess what I am asking: is it possible to dynamically change the
web.config file depending on the which server it resides on or is the
web.config static?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Path 2
Server.MapPath("~") 4
PlaceHolder + Events 1
XML, LINQ and Server.MathPath 4
Server.MapPath Failed to map the path error 4
Server.MapPath 2
Server.MapPath 3
Connect to Access via Remote Object 5

Back
Top