Access Excel File On Different Server ** Help Urgently Needed Plz **  
Author Message
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

Hi all,

I am trying to link to an excel file on a web directory on a different server but can't seem to get access to the file, This is the code i'm using:

Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _

& "Data Source=\\fse1web563\fsetrain$\public\Equiv\FSE_PAS.xls;" _

& "Extended Properties=Excel 8.0;"

Any ideas, help appreciated



.NET Development32  
 
 
ahmedilyas





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

what happens when you try it how do you normally access the file in Windows try pasting that path from the data source into Windows Explorer and see if you can access it, if not, then that is your problem and you need to find the correct path to the file

 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

When i try to access it using the code i've shown it brings up an error "Cannot create file".

I can access the directory fine in windows explorer.

Rgds,


 
 
ahmedilyas





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

cannot create file Can't be right since you are trying to access it correct Make sure that the directory has permission to write to if you are trying to save changes to the excel file. So the path is correct and is connecting

 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

At the moment i'm just trying to retrieve the data, though i have all permissions.

Is the code i'm using to connect to the file correct do you know

Note: The file is on a different server location

Rgds


 
 
ahmedilyas





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

I've tried it on mine using this:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\server\\C$\\Book1.xls;Extended Properties=""Excel 8.0;"""

Does this one work for you difference being that the Extended Properties section is in double quotes



 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

This doesn't work either. I can access the file fine when its on my server with this code:

Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _

& "Data Source=" & Server.MapPath("../Equiv/FSE_PAS.xls") _

& ";" & "Extended Properties=Excel 8.0;"


but it has to be on another server.


 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top


This looks like a web application. Where is the web application running and what type of authentication is it configured for

 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

Its running from another server. There is no authentication required, anyone can access & use it

Rgds,


 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top


OK, so your web application has been configured for Anonymous access only Is the Excel file on the same server as the web application or is it on a remote resource

 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

Yeah its on a remote server. Full control priviledges have been set up for Everyone
 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top


In this configuration you have a delegation scenario. If impersonation is not enabled (in web.config) your ASP.NET application will be running under a local least privileged account called ASPNET (Windows 2000) or NetworkService (Windows 2003). Since one of these local accounts will be the process owner there must be a matching local account on the other machine that has the same password in order for delegation to succeed. The corresponding local account on the remote machine must also have sufficient privileges to access the file.

There are some other options and I'll mention a relatively easy one. In IIS you can configure your web application to run under a domain account, enable impersonation for your web app (in the web.config file) and provide sufficient permissions for the domain account to access the file.



 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

Thanks for help so for guys. Just to confirm my code though, is the code i'm using correct:

Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _

& "Data Source=\\fse1web563\fsetrain$\public\Equiv\FSE_PAS.xls" _

& ";" & "Extended Properties=Excel 8.0;"

 

Rgds & thanks for help


 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top


The connection string syntax looks fine to me although I can only assume that the UNC path to the Excel file is correct.

 
 
Donaghy





PostPosted: .NET Framework Data Access and Storage, Access Excel File On Different Server ** Help Urgently Needed Plz ** Top

When i run windows explorer I can access the excel file via \\fse1web563\fsetrain$\public\Equiv\FSE_PAS.xls no problem.

I will give your suggestion a good go anyhow.

Thanks again.