Home directory in IIS?

  • Thread starter Thread starter Krunom Ancini
  • Start date Start date
K

Krunom Ancini

Hi,


all stuff works fine if i define absolute paths but with relative i have
some problems:
i defined my at Internet Information Services (IIS) home directory of my
"default web site" and I define in my application all file destinations
relative to this home directory. An example from .aspx file:

<TABLE id="Table1" style="WIDTH: 963px; HEIGHT: 527px" cellSpacing="0"
cellPadding="0" width="963" align="center"
background="pics\background.gif" border="0">

and it works fine. But if I define in web.config path of my database:


<appSettings>
<add
key="connstr"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mdb\database.mdb;"
/>
</appSettings>


and run my application that use this database i get this error message:


Server Error in '/' Application.
----------------------------------------------------------------------------
----
'C:\WINNT\system32\mdb\database.mdb' is not a valid path. Make sure that the
path name is spelled correctly and that you are connected to the server on
which the file resides.


But my home directory defined in IIS is NOT "C:\WINNT\system32\"! My home
directory is some other directory on hard-disc and NOT "C:\WINNT\system32\"!


Whats wrong? Why is application searching for a database relative to
"C:\WINNT\system32\" and not relative to "home directory" defined in IIS?
Please help...



Thanks in advance,

Krunom.
 
Hi,


and i have same problem if i place my application at web-host:
application search for a database relative to 'C:\WINNT\system32' and not
relative to root!

Why?


Please help...
 
When using JET, you must physically specify the full path the to data
source. You can't just imply where the data is.
 
Use

<add key="connstr" value="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=drive:\somepath\subdir\database.mdb;" />



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
If you don't know the physical path of the database on your web hosting
service, you can use Server.MapPath(...) (for ASP) or Page.MapPath(...) (or
Me.MapPath, for ASP.NET) function to find it.

S. L.
 
Back
Top