Unblocking Assembly Due to AspNetHostingPermission Security Exception25 Aug 2009
Ok, I am one of those strange birds who jumped over Windows Vista and went straight from Windows XP to Window 7, so I haven’t had the pleasure to experience many of the security features that supposedly protect the user from themselves.
After banging my head on the proverbial wall one too many times, I finally figured out the cause of a Security Exception I was getting while trying to add xVal Validation Framework into my ASP.NET MVC v2 Preview 1 project.
“System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.”
It appears that Windows 7 (and from what I’ve heard Windows Vista also does this as well) attempted to protect me from a potential threat! When looking at the file properties dialog of the xVal.dll there was a security message at the bottom stating…
“This file came from another computer and might be blocked to help protect this computer.”
Next time, I hope not to waste half my day trying to figure this out. If you have not already faced this pain, I hope that you don’t have to in the future, or that this post will help you resolve it quickly!