Connecting Tech Pros Worldwide Forums | Help | Site Map

System.UnauthorizedAccessException

DavidS
Guest
 
Posts: n/a
#1: Nov 18 '05
Attempt to open Excel file using ASP.NET. Sample snipet of source code is as
follows:
Dim _RptDocument As Object, _RptFormat As Object
Dim _RptFile As String = "C\Downloads\<any file name>.xls"

_RptFormat = New Excel.Application()
_RptDocument = _RptFormat.WorkBooks
_RptDocument.Open( _RptFile )
_RptFormat.Visible = True

When I use impersonation in ASP.NET application - web.config file...
<identity impersonate="true"/>
I have no problem opening this on my local machine. When I use the network
- I continually get access denied.

If I use a username tag as follows:
<identify impersonate="true" username = "Domain\username"
password="password/> - NOTE: I also set the security settings for
"R/W/Modify" for the folder too!
I get the following run-time error...
Source: System.Web
Error: Exception of type System.Web.HttpUnhandledException was thrown.

'C:\Downloads\Rpt.xls' could not be found. Check the spelling of the file
name, and verify that the file location is correct.

What do I need to do on the IIS server - or what security settings - what
account could I use to have the instruction "_RptFormat = New
Excel.Application()" work properly - and view the Excel file from the server.


Closed Thread