generte excel through asp.net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: hari krishna (harikrishna_at_discussions.microsoft.com)
Date: 09/20/04


Date: Sun, 19 Sep 2004 20:53:01 -0700

hi,
 i am trying to generate excel reprots through asp.net.
 i am using win2000 web server, office 2000 (excel 2000), IIS 5.0, .NET 1.1
versions.
 I have a sample code to generate XL reports through VB.NET windows
applications.
 It is working fine with windows application.
 But when i tried to do the same through ASP.NET (code behind is VB), at the
time of accessing Excel.application (at the line: Dim oExcel As
Excel.Application = New Excel.Application) it gave error and says permissions
denied. I already added a reference for Excel component.
 I searched through internent and i came to know that i should give some
launch/access permissions for excel 2000 application through DCOMCNFG. And i
did give those permissions. Even it says 'access denied' as below.any body
has any idea about this. pls give solution.
Error it gave is:
Access is denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the boxes
for the desired access.

Source Error:

Line 28: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Line 29:
Line 30: Dim oExcel As Excel.Application = New Excel.Application
Line 31:
Line 32: Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
 

Source File: E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.vb Line: 30

Stack Trace:

[UnauthorizedAccessException: Access is denied.]
   WebApplication1.WebForm3.Page_Load(Object sender, EventArgs e) in
E:\Inetpub\wwwroot\WebApplication1\WebForm3.aspx.vb:30
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

 



Relevant Pages

  • KB articles for printing problems missing
    ... Last week we were loking for a solution to a problem printing from Excel ... request it again, but the KB article is not showing correctly ... Excel or Word cannot print multiple copies of a multipage document after you ... This occurs after you install the .NET Framework 3.0 on a Windows ...
    (microsoft.public.windowsxp.general)
  • Re: SSL and Server Windows 2003
    ... on windows 2003. ... Where do I set the permissions to request a cert thru web ... Ran the certificate wizard in iis to get the cert and it ...
    (microsoft.public.inetserver.iis.security)
  • Re: Password protect Excel and Word FOLDERS (not just files)
    ... This cannot be done through Excel or Word alone. ... If running a Windows NT based OS like Windows XP you can use "permissions" to ... lock folders. ...
    (microsoft.public.excel.misc)
  • Re: Any working SIP-phone on FreeBSD?
    ... CSV, then import CSV into Excel, when the boss turns his/her back? ... and on the "Windows" platform (that the scrapped PCs ... I do not have high hopes for Skype in the future. ...
    (freebsd-questions)
  • Opening EXCEL Documents in separate Windows vs. a Shared Window
    ... The option in excel to ?Ignore other applications that use Dynamic Data Exchange? ... Opening EXCEL Documents in separate Windows vs. a Shared Window ... opens in the same window ... It does not matter if I install it ...
    (microsoft.public.excel.setup)