Modifying or Editing the Config File
In This Topic
In order to add permissions, you can edit the existing web_mediumtrust.config file or create a custom policy file based on the medium trust policy. If you modify the existing web_mediumtrust.config file, all Web applications will have the same permissions with the permissions you have added. If you want applications to have different permissions, you can instead create a custom policy based on medium trust.
Edit the Config File
In order to add permissions, you can edit the exiting web_mediumtrust.config file. To edit the exiting web_mediumtrust.config file, complete the following steps:
- Locate the medium trust policy file web_mediumtrust.config located by default in the %windir%\Microsoft.NET\Framework\{Version}\CONFIG directory.
- Open the web_mediumtrust.config file.
- Add the permissions that you want to grant. For examples, see Adding Permissions.
Create a Custom Policy Based on Medium Trust
In order to add permissions, you can create a custom policy file based on the medium trust policy. To create a custom policy file, complete the following steps:
- Locate the medium trust policy file web_mediumtrust.config located by default in the %windir%\Microsoft.NET\Framework\{Version}\CONFIG directory.
- Copy the web_mediumtrust.config file and create a new policy file in the same directory.
- Give the new a name that indicates that it is your variation of medium trust; for example, AllowReflection_Web_MediumTrust.config.
- Add the permissions that you want to grant. For examples, see Adding Permissions.
- Enable the custom policy file on your application by modifying the following lines in your web.config file under the <system.web> node:
<system.web>
<trust level="CustomMedium" originUrl=""/>
<securityPolicy>
<trustLevel name="CustomMedium" policyFile="AllowReflection_Web_MediumTrust.config"/>
</securityPolicy>
...
</system.web>
Note: Your host may not allow trust level overrides. Please check with your host to see if you have these rights.