473,748 Members | 2,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

relative path in web.config

Hi all, how can I use a relative path in my web.config file for an Access
db?:

Instead of using

<configuratio n>
<appSettings>
<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=c:/Inetpub/MyApp/data/database.mdb" />
...

I would rather use

<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=data/database.mdb" />

however this doesn't work: I get an error like
"C:\WINNT\syste m32\data\databa se.mdb is not a valid path. ..."
can anyone help?

cheers, Jan Vandorpe
Nov 18 '05 #1
6 11772
You unlikely have the notion of current path (preventing to have a relative
path) in this context.

I would store this info separately and would have the code translating the
relative path to an absolute path. For example you could store :

~/../../data/MyBase.mdb and use Server.MapPath to inject the absolute path
in the connection string, the path in the web.config file being relative to
the root of the web site...

Patrice
--

"openleren" <op*******@skyn et.be> a écrit dans le message de
news:41******** *************** @news.skynet.be ...
Hi all, how can I use a relative path in my web.config file for an Access
db?:

Instead of using

<configuratio n>
<appSettings>
<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=c:/Inetpub/MyApp/data/database.mdb" />
...

I would rather use

<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=data/database.mdb" />

however this doesn't work: I get an error like
"C:\WINNT\syste m32\data\databa se.mdb is not a valid path. ..."
can anyone help?

cheers, Jan Vandorpe

Nov 18 '05 #2
Hi,

I am not following you:

Firstly I have tried ~/data/MyBase.mdb and it doesn't work because the
server transplants it for some reason on my system32 directory.
Secondly how can I use Server.mapPath in an xml file?

sorry...

Jan

"Patrice" <no****@nowhere .com> wrote in message
news:OB******** ******@TK2MSFTN GP09.phx.gbl...
You unlikely have the notion of current path (preventing to have a relative path) in this context.

I would store this info separately and would have the code translating the
relative path to an absolute path. For example you could store :

~/../../data/MyBase.mdb and use Server.MapPath to inject the absolute path
in the connection string, the path in the web.config file being relative to the root of the web site...

Patrice
--

"openleren" <op*******@skyn et.be> a écrit dans le message de
news:41******** *************** @news.skynet.be ...
Hi all, how can I use a relative path in my web.config file for an Access db?:

Instead of using

<configuratio n>
<appSettings>
<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=c:/Inetpub/MyApp/data/database.mdb" />
...

I would rather use

<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=data/database.mdb" />

however this doesn't work: I get an error like
"C:\WINNT\syste m32\data\databa se.mdb is not a valid path. ..."
can anyone help?

cheers, Jan Vandorpe


Nov 18 '05 #3
I'll try to rephrase that.

IMO it's best to avoid non controlled relative path in a connection string
(what is the current path for an OLEDB provider ?).

Instead of storing the whole connection string in a single entry in the web
config file, I would store the Data Source entry as a separate entry in the
web config file. When the app retrieve this entry it can then use
server.mappath (or whatever else) to translate this relative path to an
absolute path. This absolute path can then be used to construct the final
connection string.

As a side note and as for now the path is taken relative to
c:\windows\syst em32, the other option would be to create your relative path
to your file from the c:\windows\syst em32 directory. That said and should
this base directory change for some reason, it would messed up the file
path.

Patrice

--

"openleren" <op*******@skyn et.be> a écrit dans le message de
news:41******** *************** @news.skynet.be ...
Hi,

I am not following you:

Firstly I have tried ~/data/MyBase.mdb and it doesn't work because the
server transplants it for some reason on my system32 directory.
Secondly how can I use Server.mapPath in an xml file?

sorry...

Jan

"Patrice" <no****@nowhere .com> wrote in message
news:OB******** ******@TK2MSFTN GP09.phx.gbl...
You unlikely have the notion of current path (preventing to have a

relative
path) in this context.

I would store this info separately and would have the code translating the
relative path to an absolute path. For example you could store :

~/../../data/MyBase.mdb and use Server.MapPath to inject the absolute path in the connection string, the path in the web.config file being relative

to
the root of the web site...

Patrice
--

"openleren" <op*******@skyn et.be> a écrit dans le message de
news:41******** *************** @news.skynet.be ...
Hi all, how can I use a relative path in my web.config file for an

Access db?:

Instead of using

<configuratio n>
<appSettings>
<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=c:/Inetpub/MyApp/data/database.mdb" />
...

I would rather use

<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=data/database.mdb" />

however this doesn't work: I get an error like
"C:\WINNT\syste m32\data\databa se.mdb is not a valid path. ..."
can anyone help?

cheers, Jan Vandorpe



Nov 18 '05 #4

hi all,

good forum this! :)

my problem is, basically:
microsoft access
page forms
page connection is unable to connect once i hosted it in my web
i already tried to change the path, both to absolute and relative path
but once i saved itm, it always returns to C:

example:relativ e
i changed it to /data_files/database.mdb
when i open it again it has changed to C:/data_files/database.mdb

example: absolute
i change it to ftp://blablabla
then it changed to: C:\blablabla\ftp://blablabla

please help :(

thanks in advance :)

--
anfieldadorer
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jan 23 '06 #5

anfieldadorer wrote:
*hi all,

good forum this! :)

my problem is, basically:
microsoft access
page forms
page connection is unable to connect once i hosted it in my web
i already tried to change the path, both to absolute and relative
path
but once i saved itm, it always returns to C:

example:relativ e
i changed it to /data_files/database.mdb
when i open it again it has changed to C:/data_files/database.mdb

example: absolute
i change it to ftp://blablabla
then it changed to: C:\blablabla\ftp://blablabla

please help :(

thanks in advance :) *


please :(

--
anfieldadorer
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jan 24 '06 #6
WHAT are you talking about - we cannot read your mind :-)

--Daniel
http://staff.newtelligence.com/danielf/


-----Original Message-----
From: anfieldadorer [mailto:an****** ************@ma il.codecomments .com]
Posted At: Tuesday, January 24, 2006 12:14 PM
Posted To: microsoft.publi c.dotnet.framew ork.aspnet
Conversation: relative path in web.config
Subject: Re: relative path in web.config
anfieldadorer wrote:
*hi all,

good forum this! :)

my problem is, basically:
microsoft access
page forms
page connection is unable to connect once i hosted it in my web
i already tried to change the path, both to absolute and relative
path
but once i saved itm, it always returns to C:

example:relativ e
i changed it to /data_files/database.mdb
when i open it again it has changed to C:/data_files/database.mdb

example: absolute
i change it to ftp://blablabla
then it changed to: C:\blablabla\ftp://blablabla

please help :(

thanks in advance :) *


please :(

--
anfieldadorer
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
Jan 24 '06 #7

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

Similar topics

7
2778
by: Doug | last post by:
If I were to write an include with a relative path like include("../conf/config.php"); What is the use? As far as I understand it, the path is relative to the first script that is called by php. In other words, if the current working directory is /www/ and you were
3
2459
by: mrzoab | last post by:
hello........ I'm developing a client software. i'm now actually using an absolute path for my connection string in my program abd this will be a problem when i want to deploy it into another computer. how do i solve this? Thank you
1
5359
by: Prateek | last post by:
Hi, I am using appSettings in Web.Config to store my connection string. However, I am not able to provide a relative path to the Access database. How can I do that? TIA Prateek
2
6433
by: Harshdeep Mehta | last post by:
Hi all gurus, Myself Harshdeep Mehta, you can call me Harsh. I struck up in a situation where I need to define relative path in Web.Config. I.e. suppose I have a "Export" named folder, besides Web.Config in same location or somewhere in reference to web.config. Then how to define that. I know one easy solution but need better than that. the easy solution is
8
1966
by: dw | last post by:
Hello, all. I have a site that I'm testing on my LOCALHOST and also on a remote server, depending on whether I'm at work or at home. I don't want the OLEDBDATAAdapter to be pointing to the remote Access db, but to the local one. The OLEDBDATAAdapter wizard puts the entire path of the db (\\myserver\.... or c:\myprojects\....). The db resides within the site's folders; is there anyway to use relative paths for it (something like...
3
12231
by: JamesPaulHart | last post by:
Howdy! I'm following the Microsoft article http://msdn2.microsoft.com/en-us/library/ms228042.aspx to add Version info to my precompiled dlls. Essentially, it states that I modify my Web.Config file by adding a <CodeDomelement that points to the location of my AssemblyInfo.Cs file. So far so good.
1
3486
by: =?Utf-8?B?Uk1C?= | last post by:
I am using the Configuration Application Block, and I want to keep my config files in a folder off of the app root called config. I have modified the app.config to point to the folder with a relative path (see example below) <storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="..\config\exceptionHandlingConfiguration.config" /> I can edit my configuration with the entlib config tool with no...
6
2497
by: Royan | last post by:
Ok the problem is quite hard to explain, but i'll try to keep it as simple as i can. Imagine I have the following structure of my files and folders: /root/global.inc |__/files/foo.php |__/utils |__/logs/logger.inc When I run foo.php I get the following error:
2
4302
by: BD | last post by:
Hi there. Using 8.2 on Windows. I have a situation where I have a db backup, which I want to deploy to a group of developer workstations. The target directory for the database files will be consistent, but the location that the backup file is on may vary. I have gone through the entire backup and restore process, and it
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.