Security Exception help needed

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
dontnet1983
Posts: 1
Joined: Fri 21 Aug 2009 15:28

Security Exception help needed

Post by dontnet1983 » Fri 21 Aug 2009 16:05

I am new to web hosting.
I am hosting my site on 1and1(UK)
I am using .NET 3.5 and LINQ to SQL class in my application. My website works

absolutely fine without any errors or warnings on localhost.
I am getting the following security exception:

Security Exception
Description: The application attempted to perform an operation not allowed by the
security policy. To grant this application the required permission please contact your
system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of
type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.

Stack Trace:
[SecurityException: Request for the permission of type
'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm,
PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh,
SecurityAction action, Object demand, IPermission permThatFailed) +150
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission
permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants,
PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object
assemblyOrString, SecurityAction action, Boolean throwException) +284
System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet,
PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset,
RuntimeMethodHandle rmh) +150
System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags,
PermissionSet grantSet) +30
System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags,
PermissionSet grantSet) +40
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant, CompressedStack securityContext) +123
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant) +54

I read some posts online and made the following changes, yet receive this error.
1. Added the following to web .config:















Also, added web_mediumtrust.config file from the .net framework to the project.

2. Added the following to the assembly:
[assembly: AllowPartiallyTrustedCallers]
[assembly: PermissionSetAttribute(SecurityAction.RequestOptional,

Unrestricted=true)]

3. Changed my LINQ to SQL file permissions to write and execute as well.

4.
I added the following to the mediumtrust.config file, still doesn't work:

....



- In the section, nested in the ASP.NET ,

add a element for reflection permission, as follows:


...







Please help me, I need to get this working as soon as possible.
Any suggestions are much appreciated.
Many thanks.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 26 Aug 2009 07:11

Please specify what problem do you have with SecureBridge components?

Post Reply