W
will eichert
New to .NET, and trying to get a web application using one of my older
COM components to work.
It works from VB.NET or VB.C# desktop app, but when instantiating an
object from my COM component in an ASP.NET app, I get the Access
Denied error.
I have disabled the Indexing service, and granted full privileges to
the {MACHINE}\ASPNET account for this file, and it still doesn't work.
I wasn't certain which files need privileges for the {MACHINE}\ASPNET
account, so I granted the privileges from the files mycomponent.exe
(this is the actual COM component), and all of the files in the BIN
directory of my app (interop.mycomponent.dll, interop.vba.dll,
mycomponent.dll, mycomponent.pdb).
I am not impersonating, and would like to save myself the trouble of
impersonating, unless it's really necessary.
Can anyone tell me why I'm getting this message, and how to resolve
the problem?
The full text of the message is below.
Thanks,
Will Eichert
Server Error in '/sensors' Application.
--------------------------------------------------------------------------------
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: Dim i As Int16, tstr As String
Line 29: 'gInitializer =
Server.CreateObject("SensorServices.SensorInitializer")
Line 30: gInitializer = New SensorServices.SensorInitializer
Line 31: tags = gInitializer.tags
Line 32: For i = 1 To tags.tagcount
Source File: c:\inetpub\wwwroot\sensors\WebForm1.aspx.vb Line: 30
Stack Trace:
[UnauthorizedAccessException: Access is denied.]
sensors.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sensors\WebForm1.aspx.vb:30
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
COM components to work.
It works from VB.NET or VB.C# desktop app, but when instantiating an
object from my COM component in an ASP.NET app, I get the Access
Denied error.
I have disabled the Indexing service, and granted full privileges to
the {MACHINE}\ASPNET account for this file, and it still doesn't work.
I wasn't certain which files need privileges for the {MACHINE}\ASPNET
account, so I granted the privileges from the files mycomponent.exe
(this is the actual COM component), and all of the files in the BIN
directory of my app (interop.mycomponent.dll, interop.vba.dll,
mycomponent.dll, mycomponent.pdb).
I am not impersonating, and would like to save myself the trouble of
impersonating, unless it's really necessary.
Can anyone tell me why I'm getting this message, and how to resolve
the problem?
The full text of the message is below.
Thanks,
Will Eichert
Server Error in '/sensors' Application.
--------------------------------------------------------------------------------
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: Dim i As Int16, tstr As String
Line 29: 'gInitializer =
Server.CreateObject("SensorServices.SensorInitializer")
Line 30: gInitializer = New SensorServices.SensorInitializer
Line 31: tags = gInitializer.tags
Line 32: For i = 1 To tags.tagcount
Source File: c:\inetpub\wwwroot\sensors\WebForm1.aspx.vb Line: 30
Stack Trace:
[UnauthorizedAccessException: Access is denied.]
sensors.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sensors\WebForm1.aspx.vb:30
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()