I published a web app to a server and I would like to access a database file (.mdb) that is also stored on the server in a different location outside of mine. How can I do this in the web.config file of my Asp.Net app?
<add name="MyOleDbConnection" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source= **{?}** \inventory.mdb"/>
I don’t believe you can do it from code, using anything like Server.MapPath() – and for good reason. This would allow developers to write apps that take over host operating systems on cloud servers. You’re restricted from determining the path of files/folders outside of the control of IIS to prevent directory traversal attacks.
You’ll need to ask a SysAdmin, or someone who has access what the path is on that machine. Once you have the full path, you can set the full path in the .config
instead of
You will also need to make sure that the SysAdmin grants you permissions to access the .mdb.