locked
Connect to Database on Client PC? RRS feed

  • Question

  • User937631264 posted

    Is there any way from within an ASP.Net page to connect to an Access Database that is stored on the client PC's local hard drive or local area network drive?

    I can connect to an Access Database from within an ASP.Net page when the database is stored on the same web server as the ASP.Net page.  But, when the database is stored on the client PC's local hard drive, I don't know what to specify for the database location (Data Source) in the ConnectionString property of the OleDbConnection object.  As an example, if the database is stored as "C:\foldername\database.mdb" on the client PC, "C:\foldername\database.mdb" is not interpreted the same by the ASP.Net page on the web server.

    I realize that this is probably not the standard way to have things organized with the database on the client PC's hard drive.  The current goal of the associated web site is to provide a database management service using a database that the web site user/customer is responsible for storing and protecting.  In theory, each user/customer will have a separate/dedicated database that no other customer will be able to access.

    Friday, May 29, 2009 4:01 PM

Answers

  • User-364289655 posted

    There are 2 ways I can think of.

     Database Server:

    If the user installs the database along with the server piece to / routing to access it via the web, then they could give you the url to that server (you might even be able to generate the url yourself if you setup your database install software correctly). Then it would be their ip address + some port. This assume that they aren't behind firewalls / routers etc that might screw up this routing. You could then use this URL for your connection string and connect like any other database.

    A Plugin / Browser Helper Object:

    I don't work with these particular techonologies, but I found this Wikipedia entry that might get you off in the right direction (this is for IE, you'd need to create a separate plugin for firefox or any other browsers you want to support):

     http://en.wikipedia.org/wiki/Browser_Helper_Object

    They are basically little programs that users install on their system, which could then be created to interact with your page, which could be written to give your webapp access to the database. The problem is that the database would only be accesible to your web app if it was on the computer that was visiting it. So if you have a client X on pc XPC (with the db), he would have to visit your app on XPC, if he was on his buddies computer YPC, he could not access the database.

    ~P

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 4:57 AM
  • User-1199946673 posted

    I really can't imagine why you want to create a web application that uses a local database? Create a windows application instead!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 7:28 AM
  • User-821857111 posted

    I agree with Hans.  I cannot see the point of developing a central web application if the different client databases are stored on their local machines/networks.  That's a job for a Windows app.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 1:34 PM

All replies

  • User-364289655 posted

    There isn't any way to do this in an asp.net page, without using some custom plugin.

    This is a security risk if your page had access to their files.

    ~P

    Friday, May 29, 2009 5:05 PM
  • User937631264 posted

    I take it by your response that there is no way to get/specify a location for a client database in a ConnectionString stored in the .aspx.vb file.  Is that correct?

    What is a custom plugin?  Is it JavaScript?  In what language is it written?  Does it reside in an .aspx file?  If not, where does it reside?  (I'm a beginnner and currently challenged by some of the terminology.)

    Is there a way for a client to give only a specific web site access to a specific local file, but deny access to all other local files?

    Thanks for your interest in my question.

    Friday, May 29, 2009 5:45 PM
  • User-364289655 posted

    There are 2 ways I can think of.

     Database Server:

    If the user installs the database along with the server piece to / routing to access it via the web, then they could give you the url to that server (you might even be able to generate the url yourself if you setup your database install software correctly). Then it would be their ip address + some port. This assume that they aren't behind firewalls / routers etc that might screw up this routing. You could then use this URL for your connection string and connect like any other database.

    A Plugin / Browser Helper Object:

    I don't work with these particular techonologies, but I found this Wikipedia entry that might get you off in the right direction (this is for IE, you'd need to create a separate plugin for firefox or any other browsers you want to support):

     http://en.wikipedia.org/wiki/Browser_Helper_Object

    They are basically little programs that users install on their system, which could then be created to interact with your page, which could be written to give your webapp access to the database. The problem is that the database would only be accesible to your web app if it was on the computer that was visiting it. So if you have a client X on pc XPC (with the db), he would have to visit your app on XPC, if he was on his buddies computer YPC, he could not access the database.

    ~P

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 4:57 AM
  • User-1199946673 posted

    I really can't imagine why you want to create a web application that uses a local database? Create a windows application instead!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 7:28 AM
  • User-821857111 posted

    I agree with Hans.  I cannot see the point of developing a central web application if the different client databases are stored on their local machines/networks.  That's a job for a Windows app.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 30, 2009 1:34 PM
  • User-364289655 posted

    I completely agree with both of the above posters, I was just trying to work within the framework of the question :)

    Sunday, May 31, 2009 6:06 AM