Last post Jun 09, 2011 04:04 AM by SilverShadow
Jun 05, 2011 03:31 AM|SilverShadow|LINK
I have been googling and trying to resolve this issue for weeks now. My work is delayed and I need to resolve this issue with your valuable help asap.
I just need to read some data from a network shared, password protected Access 2007 (.accdb) using sqlDataSource and GridView. I am using VWD 2008 EE.
When I run the page on VWD it runs fine and i can see the data no problem, but when i deploy it on the web server i get the following error message and i cannot see the page. The server is 2003 x64 with IIS 6 and the database is on another server, 2003 x64.
When I remove the password it works fine. I tried to run the page on another computer, vista, with having the database on the same computer, but I get the same error.
Exception Details: System.Data.OleDb.OleDbException: Not a valid password.
The connection string is:
<add name="ConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\server\folder\db1.accdb;Persist Security Info=True;Jet OLEDB:Database Password=12345"
Jun 05, 2011 04:34 AM|nobdy|LINK
Try the connection strings mentioned in following article and see is any works for you
I hope this helps.
Jun 05, 2011 05:53 AM|SilverShadow|LINK
Dear nobdy, thank you for your reply. I came accross this page in my weeks of strugle and it was of no use.
Jun 05, 2011 05:58 AM|nobdy|LINK
There Might be permission issue on that folder or database.
You can also try to access using Simple OleDbDataAdapter and see if its working fine that way.
Jun 05, 2011 06:06 AM|SilverShadow|LINK
I dont think it is a permission issue, because i was getting a permission error before that error and ive resolved it by giving full permssions for the IIS user to the shared folder.
Jun 05, 2011 06:07 AM|nobdy|LINK
Then you should try to connect to database by using OLEDBDataAdapter if works fine them move to SqlDataSource.
Jun 05, 2011 06:25 AM|SilverShadow|LINK
Ive tried to use the data adapter, and believe it or not i got the same error. i think this is an IIS issue more than ASP.NET, because the page works perfectly when i run from VWD. below is the code i used for the data adapter.
Dim myConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\server\folder\db1.accdb;Persist Security Info=True;Jet OLEDB:Database Password=12345")
Dim myCommand As OleDbCommand = New OleDbCommand("SELECT * FROM [dbTable]", myConnection)
Dim myDataAdapter As OleDbDataAdapter = New OleDbDataAdapter(myCommand)
Dim myTable = New DataTable
GridView1.DataSource = myTable
Jun 05, 2011 06:34 AM|nobdy|LINK
This guy has same problem but got it fixed.
I hope this works for you.
Jun 06, 2011 05:41 AM|KumarHarsh|LINK
Jun 06, 2011 07:17 AM|SilverShadow|LINK
Thank you Nobdy & KumarHarsh for the links. but i am afraid non of them helped.
Jun 06, 2011 08:01 AM|KumarHarsh|LINK
i) Check Firewall setting.Contact Administrator.
ii) I still doubts permission problem.In Server give permission to that folder where db is .
(1) If you are mapping to a mahine which is member of domain, then u must logon to the machine as a
domain user and check if that user or group of which that user is member of has permissions for that share.
(2) if the machine u r mapping to is NOT a member of domain, then u must logon to the xp machine with a
and passwordwhich exist on the machine u r trying to map. for this u must have same user account on the xp machine which u have on ur other machine, i dont know if the other machine is
xp, 98, nt or 2000.
iii) In server,debug your code.Check the connection string,uid and pwd.
iv) In order to test.Remove password from mdb file.Then is it working well everywhere ?
Jun 06, 2011 08:18 AM|KumarHarsh|LINK
i)Install Microsoft Office Connectivity tools on the server.
Jun 07, 2011 07:19 AM|cts-mgraham|LINK
The main difference running in IIS instead of VWD is that the process running will be w3wp.exe and run as the applicationPool identity. When running VWD, you are likely running as yourself, and you likely have more privileges than the application pool identity
(usually Network Service, or if 2008 - AppPoolIdentity). I'm not an Access expert, but you might try impersonating an escalated user as a test. To do this, add <identity impersonate="true" userName="<name>" password="<pwd>". See if that gets it to work.
If it does, you might try running procmon when it's failing to see if it's a file or registry permission that is missing. Technically, I don't think it is supported to use ACE in a web application (see:
If you want to use impersonation to connect, you can follow one of the methods here:
306158 How to implement impersonation in an ASP.NET application
Jun 08, 2011 09:06 AM|SilverShadow|LINK
cts-mgraham, you are a star.
impersonation did solve the problem. i actually came across it in the weeks of search but i did not use it because i did not suspect it is a permission issue given that i resolved a permission error before this error as explained in my first post and that
i created a user for the application pool and gave it all folder permission. in addition, "not a valid password" was more of an access error rather than a permission error.
i shall mark your post as an answer. but there is on problem though, and you might help me with that, it only works if i impersonate my user account and it does not work if i personate another account. even if a provide all privileges to this account. i
certainly dont want to use my account, so is there a way out from this?
Jun 09, 2011 03:01 AM|SilverShadow|LINK
i just found out that the impersonated user account has to be logged on the web server in order for the page to work. in other words, if the user is not logged in, the page will through the same error message "not a valid password". this is some weird stuff.
what can be the cause of this? is there a way I can run this account as a service to avoid having it logged on all the time?
Jun 09, 2011 04:04 AM|SilverShadow|LINK
I found the solution.
After I applied the impersonation in ASP.NET, btw you didn't have to supply the username and passowrd in identity tag, i did the following:
1- modified GPO to allow the impersonated account to run as a service.
2- Restarted the w3wp service on the web server.
and now the page is working fine.
Thank you all for your support. you were very helpful. i should have opened this thread long time ago instead of wasting my time with search. thank you.