ASP.NET Exception on hosted server

S

Steve

When I run my ASP.NET on my computer it works fine, even in medium trust which is what mt webhost uses. However on the webhost it generates this exceptio
SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken) +66
System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride) +
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +8
System.Security.CodeAccessPermission.Demand() +6
System.Web.HttpContext.set_User(IPrincipal value) +7
newtelligence.DasBlog.Web.Global.Application_AuthenticateRequest(Object sender, EventArgs e) in Global.asax.cs:19
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +6
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +8
 
H

Holly Mazerolle

Hi,
The following could possible scenario. I am not sure what you are doing
in your app, but you can check this with the hosting provider:

Your code could be violating SecurityPermissionFlag.ControlPolicy Ability
to manipulate
the principal object

You have to be granted perms to read and write a Principal.Identity.
In the web.config (or possibly machine.config) they have configured CAS
policy to
not grant this permission to the app.
To (un)restrict, read this page:
Using Code Access Security with ASP.NET (.NET Framework Security)
http://msdn.microsoft.com/library/en-us/dnnetsec/html/THCMCh09.asp?frame=tru
e

Basically, you might need to add this in the trust level file for the app.
<IPermission
class="SecurityPermission"
version="1"
Flags="Assertion, Execution, ControlThread, ControlPrincipal,
RemotingConfiguration"
So, the web.config looks like this:

<trustLevel name="Something" policyFile="someFileLocatedSomeWhere.config"/>

Find out where someFileLocatedSomeWhere is located, and in that file look
for the
<IPermission> from above and add ControlPrincipal.
Or not. Maybe this hosting provider has a very good reason for not granting
that
permission to the app.

This could happen BECAUSE
The hosting provider has tightened their Code access security which
prevents
this.

HTH
This posting is provided "AS IS" with no warranties, and confers no rights.
Holly
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top