Groups | Blog | Home
all groups > dotnet general > november 2004 >

dotnet general : Excel System.UnauthorizedAccessException


Jane
11/2/2004 6:55:01 PM
I got the web application to open up the excel. It works fine on my
development box. But when i moved it to the production server, I cannot get
the Excel spreadsheet to open. I get System.UnauthorizedAccessException:
Access is denied.
I've granted full access for the excel file stored in the server, but still
Jane
11/3/2004 6:34:04 AM
I have granted permission....
I'd like the excel to open on the client side, but seems like is not doing
it....

here's my code:

Excel.ApplicationClass excelObj = new Excel.ApplicationClass();
excelObj.Visible=true;
Excel.Workbook newbook =
excelObj.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
Excel.Workbook workBook =
excelObj.Workbooks.Open(strFileName,0,true,5,"","",true,Excel.XlPlatform.xlWindows,"",false,false,0,true,true,false);
Excel.Sheets sheets = workBook.Worksheets;
Excel.Worksheet dataSheet = (Excel.Worksheet)sheets.get_Item("Trade Ticket
Lookup");
Excel.Range range = dataSheet.get_Range("B2",Type.Missing);
dataSheet.Select(Type.Missing);
range.Cells.Value2=tradeID;

Excel.Worksheet tradesRealSheet = (Excel.Worksheet)sheets.get_Item("Trades
(Real)");
tradesRealSheet.Select(Type.Missing);

excelObj.Application.Quit();

I don't know what I'm doing wrong here, please help!
Thanks!

[quoted text, click to view]
Cor Ligthert
11/3/2004 12:36:51 PM
Jane,

Is it opening the file on the clientside or the serverside?

Cor

"Jane" <Jane@discussions.microsoft.com>
..
[quoted text, click to view]

Cor Ligthert
11/3/2004 4:03:42 PM
Jane,

I saw that did not read it well, sorry, however maybe can this link help
you?

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q257757

Cor

Victor Hadianto
11/3/2004 4:19:26 PM
Have you tried granting the ASP user to have read access of the file? By
default this is ASPNET. Make sure you don't have 'deny' permission on that
file as well since it has higher precedence than the 'allow' permission.

--
Victor Hadianto
http://synop.com/Products/SauceReader/

[quoted text, click to view]

AddThis Social Bookmark Button