I'm currently developing a WebPart reading (and later hopefully writing) an Excel file (using Microsoft.Office.Interop.Excel). When testing I get the following error message:
Quote:
|
quote:System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
|
This is basically the code I'm running and the error occurs when executing the last command:
Code:
path = "C:\\Test.xls";
workbook = app.Workbooks.Open(path,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
sheet = (Worksheet)workbook.ActiveSheet;
excelCell = (Range) sheet.get_Range("B2", "B2");
String test = excelCell.Value2;
I'm just wondering why the "Excel-operations" are executed without producing an error except the last one.
Any ideas???