Security Exception after installing InstantForum.NET or InstantKB.NET


After installing InstantKB.NET or InstantForum.NET in a medium trust hosting environment you may receive the following error...

System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.



Cause

This error can occur if your running InstantForum.NET or InstantKB.NET in medium trust and have not installed the System.Web.Extensions.dll to the GAC.

We provide a copy of the System.Web.Extensions.dll within the "\bin" directory for either InstantForum.NET or InstantKB.NET.

Resolution

Install the correct version of the ASP.NET AJAX Extensions which will install the correct System.Web.Extensions.dll file to the GAC.

Check Your Web.Config File

If your referencing the .NET 3.5 SP1 version of the System.Web.Extensions.dll within your web.config as shown below you should ensure .NET 3.5 SP1 is installed correctly.

<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>

If your using .NET 2.0 you may be referencing the older version of the System.Web.Extensions.dll within your web.config as shown below..

<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>

If your referencing the 1.0.61025.0 version of the System.Web.Extensions.dll you'll need to install ASP.NET AJAX 1.0...
http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en

This will add the required DLL files to your GAC.

Additional Notes

If your able to run InstantKB.NET in full trust please update the <trust level ="Medium"/>
element within your web.config.

Update this to read <trust level ="Full"/>.

This should resolve the problem for customers who can run our software in full trust.

You can check which versions of the System.Web.Extensions.dll is installed within your GAC by navigating to the "C:Windows\Assembly" folder on your server.

That's It!

If we can assist with any questions as always please don't hesitate to contact us.


Posted 22 June 2010 by Ryan Healey
http://kb.instantasp.co.uk/Knowledgebase/Security-Exception-after-installing-InstantForum.NET-or-InstantKB.NET