System.Data.OleDb.OleDbException: Unspecified error while calling the Connection.Open method on an Access or Excel file within ASP.NET. This is an issue you could face while opening Excel or Access files as data sources in ASP.NET using OleDb Jet.
Cause Number 1
ASP.NET/Impersonated account doesn’t have enough privileges to create the ldb file.
Resolution Give the ASP.NET user account create/write privileges to the folder where the excel/access file is placed. If you are using impersonation, give the impersonated account the said privileges.
Cause Number 2
Impersonated account doesn’t have enough privileges to create temporary files.
Description When you open excel or access files using Jet, it requires creation of temporary files. Under ASP.NET, these files will be created under the
C:\Documents and Settings\MachineName\ASPNET\Local Settings\Temp folder. By default, the ASP.NET user account is given full access to this folder. Now, when you are using impersonation, the impersonated account naturally wouldn’t have access to this folder. Consequently, the Jet engine wouldn’t be able to create the temporarily files while opening connections to excel or access files under ASP.NET. Due to this, the OleDb provider throws an exception with no specific message -
System.Data.OleDb.OleDbException: Unspecified error. Resolution Give the impersonated account full access to the above mentioned folder.
Check out the Microsoft support article
here[
^]