0

I get this, to me, completely random error:

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Stack Trace:

[SecurityException: Request for the permission of type'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral,     PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +42
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +145
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +73
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +111
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +279

Whenever I try to run my asp.net site that uses a service I created. The site is part of a project that also contains the service.

I don't use IIS or other stuff so don't tell me about that pool thing.

Edit: I always have it

  • New project with new service and web site;
  • Framework 1.0 tot 4.0;
  • Adding to in the web.config file;
  • It's got nothing to do with IIS;

I might need to add that It's on my NAS.

Solved, well, partly, It gave the error because it was on my NAS.

James McNellis
  • 348,265
  • 75
  • 913
  • 977
reaper_unique
  • 2,916
  • 3
  • 28
  • 48

2 Answers2

0

The solution to the problem is that it was located on my NAS and that caused security issues. Moving it to a folder in my PC solved the problem.

reaper_unique
  • 2,916
  • 3
  • 28
  • 48
0

here is an interesting post. this guy had a similar issue when using AjaxControlToolkit. Hope it helps: AjaxControlToolkit and SecurityException

  • nope, that's not it. The problem is when I change my web.config file to framework 3.5. I use Loginview btw. – reaper_unique Jan 02 '12 at 17:08
  • desperately trying to help you man: InsertAfter: /configuration/system.web/*[last()] – dotnetPr0 Jan 02 '12 at 17:24
  • Nope not working. It's really strange and frustrating since it's the first time I get this. The strange thing is that I can't find System.Web.AspNetHostingPermission in my web.config file. Adding it doesn't do anything either. – reaper_unique Jan 02 '12 at 17:32
  • Making a new clean 3.5 web site and copying that web.config file doesn't help either. – reaper_unique Jan 02 '12 at 17:38
  • one more thing I can think of at the moment is that the trust level is set system wide in the machine.config or smth. and you are not allowed to override it – dotnetPr0 Jan 02 '12 at 17:53
  • It's not only with framework 3.5, in 4.0 when I try to use MessageFault fault = ex.CreateMessageFault(); XmlReader reader = fault.GetReaderAtDetailContents(); I get it as well – reaper_unique Jan 03 '12 at 21:23
  • Solved, well, partly, It gave the error because it was on my NAS. – reaper_unique Jan 03 '12 at 22:18