Home directory in IIS?

Discussion in 'ASP .Net' started by Krunom Ancini, Mar 4, 2005.

  1. 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.
    Krunom Ancini, Mar 4, 2005
    #1
    1. Advertising

  2. 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...
    Krunom Ancini, Mar 4, 2005
    #2
    1. Advertising

  3. Krunom Ancini

    Scott M. Guest

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


    "Krunom Ancini" <> wrote in message
    news:d0a4cb$kkp$...
    > 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.
    >
    >
    >
    Scott M., Mar 4, 2005
    #3
  4. 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...
    ======================

    "Krunom Ancini" <> wrote in message
    news:d0a4cb$kkp$...
    > 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.
    >
    >
    >
    Juan T. Llibre, Mar 4, 2005
    #4
  5. 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.

    "Juan T. Llibre" <> wrote in message
    news:%...
    > 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...
    > ======================
    >
    > "Krunom Ancini" <> wrote in message
    > news:d0a4cb$kkp$...
    >> 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.
    >>
    >>
    >>

    >
    >
    Sylvain Lafontaine, Mar 4, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john
    Replies:
    4
    Views:
    669
    Jim Higson
    Jun 15, 2006
  2. nancyflorida
    Replies:
    0
    Views:
    328
    nancyflorida
    Nov 12, 2007
  3. nancyflorida
    Replies:
    0
    Views:
    315
    nancyflorida
    Nov 12, 2007
  4. * Its my Pleasure *
    Replies:
    0
    Views:
    374
    * Its my Pleasure *
    Feb 20, 2008
  5. Ed
    Replies:
    4
    Views:
    266
    joker
    Aug 4, 2004
Loading...

Share This Page