Home directory in IIS?

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.
 
K

Krunom Ancini

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...
 
S

Scott M.

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

Juan T. Llibre

Use

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

Sylvain Lafontaine

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top