Click to See Complete Forum and Search --> : Problem with accessing Database


mahesh18
July 23rd, 2003, 01:53 AM
Hi All,
Here i am doing one application in ASP.NET.
IIS is running on my system and the database (MS-Access) mdb is on another system in the intranet.
I got the error as "The Microsoft Jet database engine cannot open the file '\\Paramesh\j2ee\ICAN.mdb'. It is already opened exclusively by another user, or you need permission to view its data."

If both IIS and mdb are on the same system then programme works fine.

Thanx in advance.

Regards
Mahesh

timothymo
July 23rd, 2003, 04:58 AM
do u have "write" access to the access file when it is located on another computer?

mahesh18
July 23rd, 2003, 06:35 AM
timothymo,

my mdb have the read/write permission. Then also i have the same problem.

Regards
Mahesh

coolbiz
July 23rd, 2003, 07:30 AM
See:
http://www.codeguru.com/forum/showthread.php?s=&threadid=254347

-Cool Bizs

cykophysh
July 28th, 2003, 09:11 AM
There are two solutions to your problem,

1. You may need to create a user to folder where your Access DB is loacted to that of ASP user or something similar I can't remember.

2. The other solution is that you should set the Impersonate value in the connection string to true

I hope this helps point you in the right direction, if not I do have some more info let me know if you need it

klegesdal
October 8th, 2004, 12:53 AM
I found something that works... goto the control panel and select the ASP.net "user" and change the account from limited to Admin Control. This worked ...however, am I doing a bad thing here??

kenny


>>yes I guess this is a very bad thing...a major security risk. Well I found another alternative. goto...
control panel
admin tools
IIS shortcut
find "default web site" in the tree
right click this...
click on the "Home Directroy" tab
add read and write (or what ever you need)
and finally select the "Execute Parameters"...script only or script & exe??

this enabled me to use my access db... I also put the db in the my wwwroot folder.... I guess you can actually set up the above permissions for just one folder not the entire default web site... may be better??

If anyone can share some wisdom here...as to why this is a good thing or not ...please do.... I know very little about the security issues I may be exposing here.

Thanks
kenny

coolbiz
October 8th, 2004, 07:01 AM
Both methods that you are trying open up a big security hole for you system. DO NOT EVER deploy this method on a production server :) Basically if someone managed to inject some malicious executable file into your web application, then it can be executed from the web remotely.

One method that I've been implementing is creating a VIRTUAL DIRECTORY and pointing it to a folder that is outside of your C:\INETPUB (or where ever your root web folder is). Allow read/write permission on that virtual directory but DO NOT ALLOW any type of script executions. Since it will just store your MDB, you do not need script execution permission and this will make sure even if someone managed to upload some kind of executable file (ASP, EXE, etc...), they won't be able to execute it via the website.

klegesdal
October 8th, 2004, 10:45 AM
ok... problem is when I don't allow scripts on the "default web site" I am getting an error when I try to load the IIS web application in Visual Studio (forbidden ..blah..blah)?? I'm using IIS only as development... any problems with this approach?

coolbiz
October 8th, 2004, 06:04 PM
Yes ... you CANNOT use the NOT ALLOW SCRIPT on your website since that will prevent your ASP page to be processed. My suggestion is to create a virtual directory and set the settings on that virtual directory.