These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Request for the permission of type System.Security.Permissions...

I get this when I run the setup page, any ideas?

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +59
   System.Web.HttpContext.System.IServiceProvider.GetService(Type service) +54
   GleamTech.Web.FileTransfer.UploadHttpModule.a(HttpContext A_0) +42
   GleamTech.Web.FileTransfer.UploadHttpModule.c(Object A_0, EventArgs A_1) +96
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Richard Cross 1/15/2008 3:22 PM
The application needs Full-Trust to run, you can change the trust level as follows:

Open the file <WindowsDir>\Microsoft.NET\framework\v2.0.50727\config\web.config 
with an editor. 

Locate the setting 

<trust level="Medium" originUrl="" /> 

Change "Medium" to "Full" and save the file. 
Cem Alacayir 1/21/2008 7:40 AM
I have a dedicated server, but am sharing many domains on it for my customers. I want to keep medium trust for all the other domains. How do I do full trust just for this one domain?

Cheers
Richard
Richard Cross 1/21/2008 12:46 PM
In the same web.config file above, under the <configuration> level, add these settings:

  <location allowOverride="false" path="Default Web Site">
    <system.web>
      <securityPolicy>
        <trustLevel name="Full" policyFile="internal"/>
        <trustLevel name="High" policyFile="web_hightrust.config"/>
        <trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
        <trustLevel name="Low" policyFile="web_lowtrust.config"/>
        <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
      </securityPolicy>
      <trust level="Full" originUrl=""/>
    </system.web>
  </location>


This will apply to just the site set in the path attribute, e.g "Default Web Site" or some other web site name as defined in IIS.
Cem Alacayir 1/21/2008 5:53 PM
Thanks, works a treat.

CHeers
Richard
Richard Cross 1/22/2008 1:07 AM
Hi  ! I have error when install FileVistaContol
Request for permission of type 'System.Security.Permissions.RegistryPermission,mscorlib, Version=2.0.0.0, Culuture=neutral, PublicKey Token=b77a5c561934e089' failed
Thank
vo hoang luan 3/21/2008 12:37 PM
Please change the trust level to high as described above.
Cem Alacayir 3/24/2008 6:22 PM
I have the same problem, but the Trust Level is already set to High. Any suggestions?
Mukesh 4/10/2009 2:18 PM
That was a typo in my last message, you need to set it to Full (as noted correctly at the top). High trust level is not enough.
Cem Alacayir 4/14/2009 6:14 PM
if you use sharepoint confim that you placed your assembly as safe control 
fatma Amin 11/21/2011 5:18 AM