Web Application, Web Service, Class Libraries, and StrongNameIdentityPermissionAttribute Class

M

Mythran

I have the following setup:

BLL Project
Category.vb
AssemblyInfo.vb

Schema Project
Category.xsd
AssemblyInfo.vb

Web Service Project
CategoryService.asmx
AssemblyInfo.vb

Web Application Project
WebServiceTest.aspx
AssemblyInfo.vb


In the BLL project's AssemblyInfo, I have the following:

<Assembly: AssemblyKeyName("...")>

and in it's Category.vb class:

< _
Transaction(TransactionOption.Required), _
StrongNameIdentityPermission( _
SecurityAction.Demand, _
PublicKey := "..." _
) _
Public Class Category
...


In my Web Service and Web Application projects, I have the following in
AssemblyInfo.vb files:

<Assembly: AssemblyKeyName("...")>

The key name matches the same key name in the BLL project's AssemblyInfo.vb
file. I have installed the strong-name key into the CSP and get the public
key from the dll using secutil -hex -s myassembly.dll which I place into the
StrongNameIdentityPermission attributes constructor for the Category Class
definition.

Anywho, the problem is, when I build and then run the application, I get the
following:
Server was unable to process request. --> Request for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.

Anyone have any idea how to get the StrongNameIdentityPermissionAttribute
class to work correctly? I do not want SecurityAction.LinkDemand, just
SecurityAction.Demand.

Thanks,
Mythran
 
M

Mythran

Mythran said:
I have the following setup:

BLL Project
Category.vb
AssemblyInfo.vb

Schema Project
Category.xsd
AssemblyInfo.vb

Web Service Project
CategoryService.asmx
AssemblyInfo.vb

Web Application Project
WebServiceTest.aspx
AssemblyInfo.vb


In the BLL project's AssemblyInfo, I have the following:

<Assembly: AssemblyKeyName("...")>

and in it's Category.vb class:

< _
Transaction(TransactionOption.Required), _
StrongNameIdentityPermission( _
SecurityAction.Demand, _
PublicKey := "..." _
) _
Public Class Category
...


In my Web Service and Web Application projects, I have the following in
AssemblyInfo.vb files:

<Assembly: AssemblyKeyName("...")>

The key name matches the same key name in the BLL project's
AssemblyInfo.vb file. I have installed the strong-name key into the CSP
and get the public key from the dll using secutil -hex -s myassembly.dll
which I place into the StrongNameIdentityPermission attributes constructor
for the Category Class definition.

Anywho, the problem is, when I build and then run the application, I get
the following:
Server was unable to process request. --> Request for the permission of
type System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.

Anyone have any idea how to get the StrongNameIdentityPermissionAttribute
class to work correctly? I do not want SecurityAction.LinkDemand, just
SecurityAction.Demand.

Thanks,
Mythran

Gah! Just found:

Note: Issuing a full stack walk demand for the
StrongNameIdentityPermission does not work if your assembly is called by a
Web application or Web service. This is because it is not possible to strong
name the dynamically compiled classes associated with ASP.NET Web
applications or Web services.

That stinks...so SecurityAction.Demand won't work on
StrongNameIdentityPermissionAttribute :( So, guess I have to use LinkDemand
:(

Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top