Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 1881

Unauthorized Access Exception when accessing an excel file

$
0
0

I have a .NET portal. Version of IIS is 7.5. Version of .NET is 4.5. I have a hyperlink which when clicked by the user should display some charts read from an excel file. This works perfectly fine in a development server but fails in the IIS server. I have tried all steps mentioned in various articles like giving network service user permissions to that folder etc but to no avail.  Please help. Entire trace below:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

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: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

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 and IIS 7, and the configured application pool identity on IIS 7.5) 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 access to a file, right-click the file in File 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 340:        if (((new DirectoryInfo(DestPath)).LastWriteTime.Date < DateTime.Today.Date) || (Directory.GetFiles(DestPath).Length == 0))
Line 341:        {Line 342:            xlApp = new Application();Line 343:            xlAppHandle = xlApp.Application.Hwnd;
Line 344:


Source File: c:\METRICS\PROJECTS\Default.aspx.cs   Line: 342

Stack Trace:

[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).]
   _Default.tvSections_SelectedNodeChanged(Object sender, EventArgs e) in c:\METRICS\PROJECTS\Default.aspx.cs:342
   System.Web.UI.WebControls.TreeView.OnSelectedNodeChanged(EventArgs e) +116
   System.Web.UI.WebControls.TreeView.RaisePostBackEvent(String eventArgument) +728
   System.Web.UI.WebControls.TreeView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9664706
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237             


Viewing all articles
Browse latest Browse all 1881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>