ASP.NET and OleDbConnection

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: ASP.NET and OleDbConnection

    Also make sure that aspnet has permissions on the folder and db file

    "trevor oakley" <to006e7245@blueyonder.co.uk> wrote in message
    news:CMNJa.565$5E.395@news-binary.blueyonder.co.uk...
    > 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 [url]www.domain.com[/url]
    > Database --> cannot be viewed from a browser, to stop hacking
    > Logs
    >
    > All this works with Server.CreateObject in ASP.
    >
    > Can anyone help?
    >
    >
    >

    vMike Guest

  2. #2

    Default Re: ASP.NET and OleDbConnection


    Try something like this.

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

    "trevor oakley" <to006e7245@blueyonder.co.uk> wrote in message
    news:CMNJa.565$5E.395@news-binary.blueyonder.co.uk...
    > 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 [url]www.domain.com[/url]
    > Database --> cannot be viewed from a browser, to stop hacking
    > Logs
    >
    > All this works with Server.CreateObject in ASP.
    >
    > Can anyone help?
    >
    >
    >

    vMike Guest

  3. #3

    Default Re: ASP.NET and OleDbConnection

    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" <Michael.George@nospam.gewarren.com.delete> wrote in message
    news:bd9ut2$2b9$1@ngspool-d02.news.aol.com...
    >
    > Try something like this.
    >
    > path.getpathroot(server.mappath(1)) & the rest of you path to db.
    >
    > "trevor oakley" <to006e7245@blueyonder.co.uk> wrote in message
    > news:CMNJa.565$5E.395@news-binary.blueyonder.co.uk...
    > > 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 [url]www.domain.com[/url]
    > > Database --> cannot be viewed from a browser, to stop hacking
    > > Logs
    > >
    > > All this works with Server.CreateObject in ASP.
    > >
    > > Can anyone help?
    > >
    > >
    > >
    >
    >

    vMike Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139