Ok...I'm having the oddest error and it just started today.
I have build a simple WebControl, it is an image gallery. It simply reads an XML file and renders some HTML based on the XML content. It has been functioning fine. Today, out of nowhere, the m control gets an "Access Denied" exception when on the XmlDocument.Load method. All the approriate file permissions have been granted.
To make things more interesting, if I do an XmlDocument.Load and load the same xml document from an ASPX page, in the same application, the document gets loaded just fine. From within the context of a WebControl, you get access denied.
It doesn't matter what web application you try this from, XmlDocument.Load will always fail from within the WebControl but works from an ASPX or ASCX. Granting file access permissions to system,iuser,machine,and so on, doesn't help either.
I even created a brand new WebControl on the odd chance I did something within the source to cause this, and I still have the problem.
I am using Windows XP Pro SP2. I have auto updates turned on. Could a windows updated be causing this odd security problem? Any advice is helpful.
Here is the exception.....
Access to the path "C:\projects\TechnicalLeverage.TinyGal\TechnicalLeverage.TinyGalSample" 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 to the path "C:\projects\TechnicalLeverage.TinyGal\TechnicalLeverage.TinyGalSample" 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 23: End If
Line 24:
Line 25: _XMLDoc.Load(path)
Line 26: End If
Line 27:
Source File: C:\projects\TechnicalLeverage.TinyGal\TechnicalLeverage.WebControls.TinyGal\GalleryController.vb Line: 25