473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Server.MapPath in .NET

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!

Nov 16 '05 #1
3 4231
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.

"Jay" <j@h.com> wrote in message news:3YcKc.17317$9I.7513@okepread02...
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!


Nov 16 '05 #2
Jay
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?

"Shiva" <sh******@online.excite.com> wrote in message
news:eP*************@TK2MSFTNGP11.phx.gbl...
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.

"Jay" <j@h.com> wrote in message news:3YcKc.17317$9I.7513@okepread02...
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!

Nov 16 '05 #3
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.

"Jay" <j@h.com> wrote in message news:IuyKc.21369$9I.7123@okepread02...
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?

"Shiva" <sh******@online.excite.com> wrote in message
news:eP*************@TK2MSFTNGP11.phx.gbl...
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.

"Jay" <j@h.com> wrote in message news:3YcKc.17317$9I.7513@okepread02...
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!


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: John Rebbeck | last post by:
I've got the directory f:\Company\Product set as web shared so it's got a virtual directory in the default web site on my test server's IIS. If I try to use Server.MapPath in that site it returns a...
4
by: Laphan | last post by:
Hi All Sorry to be irate, but the whole concept of Server.MapPaths really has me in a tiswas!! In order to confirm once and for all, could you please advise me on the following: 1) There...
6
by: darrel | last post by:
I have some functions that are reading/writing to the file system. As such, they use server.mapPath a lot to navigate it all. Since I'm using these functions numerous times throughout my...
7
by: benoit | last post by:
Hi, if I write this code to retrieve a folder on the server Server.mappath("/DATA") I get this error message System.InvalidOperationException: Failed to map the path '/DATA' the virtual...
14
by: Lorenzo | last post by:
Hello, I have a web application with a virtual directory in it. With 'virtual directory' i mean a folder whose physical path is different from the physical path of the application, but in which...
5
by: MichiMichi | last post by:
When using Server.MapPath on IIS 5 on my localhost everything works well. All of the following commands are executed without any error Response.Write(Server.MapPath("/app_test") & "<br>")...
4
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
3
by: rn5a | last post by:
Server.MapPath returns the physical file path that corresponds to the specified virtual path whereas Request.MapPath maps the specified virtual path to a physical path. Assuming that a file named...
6
by: withers | last post by:
If I run Server.MapPath("/") on my operational Internet server I get, correctly, the physical path to the directory my page is in (d:\.... \...\htdocs). If I run Server.MapPath("/") on my...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have one line code in my program, occasionaly I will receive the following error: "The Path parameter for the MapPath method did not correspond to a known path" ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.