Re: ASP.NET and OleDbConnection

Discussion in 'ASP .Net' started by vMike, Jun 24, 2003.

  1. vMike

    vMike Guest

    Try something like this.

    path.getpathroot(server.mappath(1)) & the rest of you path to db.

    "trevor oakley" <> wrote in message
    news:CMNJa.565$...
    > This is a repost, after people said this group is the suitable for ASP.NET
    > comments.
    >
    >
    > I am working through Teach Yourself ASP.NET in 21 Days (Day10), and I
    > have hit a problem with OleDbConnection. Maybe someone here knows a
    > lot of connections to databases in ASP.NET, and is willing to share
    > their knowledge.
    >
    > I am trying
    >
    > dbStr = Server.MapPath("../TestDatabase.mdb")
    > Response.write("db string " & dbStr)
    >
    > objConnection = New
    > OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _
    > & " Data Source=" & dbStr & ";")
    >
    > but it fails, with an error on the path (cannot exit above top
    > directory).
    >
    > The actual databases at hostway.com are stored above www so that they
    > cannot be hacked using a browser. But the path seems to expect the
    > root directory as seen by the browser. It works it I take out the ../
    > and move my database to the www directory.
    >
    > Directory structure seen at FTP logon
    >
    > www --> alias to browser accessible pages, eg www.domain.com
    > Database --> cannot be viewed from a browser, to stop hacking
    > Logs
    >
    > All this works with Server.CreateObject in ASP.
    >
    > Can anyone help?
    >
    >
    >
    vMike, Jun 24, 2003
    #1
    1. Advertising

  2. vMike

    vMike Guest

    do a response.write(server.mappath(1) to see the actually root. It is
    probably something like
    D:\root\hostaway\hostaway.com\..... you should be able to figure it from
    there. It all depends on how the server is set up.


    "vMike" <> wrote in message
    news:bd9ut2$2b9$...
    >
    > Try something like this.
    >
    > path.getpathroot(server.mappath(1)) & the rest of you path to db.
    >
    > "trevor oakley" <> wrote in message
    > news:CMNJa.565$...
    > > This is a repost, after people said this group is the suitable for

    ASP.NET
    > > comments.
    > >
    > >
    > > I am working through Teach Yourself ASP.NET in 21 Days (Day10), and I
    > > have hit a problem with OleDbConnection. Maybe someone here knows a
    > > lot of connections to databases in ASP.NET, and is willing to share
    > > their knowledge.
    > >
    > > I am trying
    > >
    > > dbStr = Server.MapPath("../TestDatabase.mdb")
    > > Response.write("db string " & dbStr)
    > >
    > > objConnection = New
    > > OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _
    > > & " Data Source=" & dbStr & ";")
    > >
    > > but it fails, with an error on the path (cannot exit above top
    > > directory).
    > >
    > > The actual databases at hostway.com are stored above www so that they
    > > cannot be hacked using a browser. But the path seems to expect the
    > > root directory as seen by the browser. It works it I take out the ../
    > > and move my database to the www directory.
    > >
    > > Directory structure seen at FTP logon
    > >
    > > www --> alias to browser accessible pages, eg www.domain.com
    > > Database --> cannot be viewed from a browser, to stop hacking
    > > Logs
    > >
    > > All this works with Server.CreateObject in ASP.
    > >
    > > Can anyone help?
    > >
    > >
    > >

    >
    >
    vMike, Jun 24, 2003
    #2
    1. Advertising

  3. Hi

    instead of
    dbStr = Server.MapPath("../TestDatabase.mdb")

    use

    dbStr = Server.MapPath("\TestDatabase.mdb")

    if your mdb file is directly under wwwroot then it should be \*.md
    file or else it should be

    \foldername\*.mdb, plz try this

    rgds

    Rajesh
    vMike Wrote:
    > Try something like this.
    >
    > path.getpathroot(server.mappath(1)) & the rest of you path to db.
    >
    > "trevor oakley" <> wrote in message
    > news:CMNJa.565$...
    > > This is a repost, after people said this group is the suitable fo

    > ASP.NET
    > > comments.
    > >
    > >
    > > I am working through Teach Yourself ASP.NET in 21 Days (Day10), an

    > I
    > > have hit a problem with OleDbConnection. Maybe someone here knows a
    > > lot of connections to databases in ASP.NET, and is willing to share
    > > their knowledge.
    > >
    > > I am trying
    > >
    > > dbStr = Server.MapPath("../TestDatabase.mdb")
    > > Response.write("db string " & dbStr)
    > >
    > > objConnection = New
    > > OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _
    > > & " Data Source=" & dbStr & ";")
    > >
    > > but it fails, with an error on the path (cannot exit above top
    > > directory).
    > >
    > > The actual databases at hostway.com are stored above www so tha

    > they
    > > cannot be hacked using a browser. But the path seems to expect the
    > > root directory as seen by the browser. It works it I take out th

    > ../
    > > and move my database to the www directory.
    > >
    > > Directory structure seen at FTP logon
    > >
    > > www --> alias to browser accessible pages, eg www.domain.com
    > > Database --> cannot be viewed from a browser, to stop hacking
    > > Logs
    > >
    > > All this works with Server.CreateObject in ASP.
    > >
    > > Can anyone help?
    > >
    > >

    >


    --
    rajeshseethara
    -----------------------------------------------------------------------
    rajeshseetharam's Profile: http://www.hightechtalks.com/member.php?userid=
    View this thread: http://www.hightechtalks.com/showthread.php?t=9298
    rajeshseetharam, Jun 6, 2005
    #3
    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. vMike

    Re: ASP.NET and OleDbConnection

    vMike, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,314
    vMike
    Jun 24, 2003
  2. Keith
    Replies:
    1
    Views:
    465
    alex bowers
    Dec 11, 2003
  3. Steven K

    OleDbConnection: ASP vs ASP .Net

    Steven K, Mar 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,288
    Kevin Spencer
    Mar 4, 2004
  4. mtcc
    Replies:
    2
    Views:
    990
    Derek Harmon
    Oct 2, 2005
  5. Dan
    Replies:
    2
    Views:
    1,845
    trevor oakley
    Jun 23, 2003
Loading...

Share This Page