Request for the permission of type 'System.Web.AspNetHostingPermission' failed

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
11/3/2008 9:07:55 AM
Gravatar
Total Posts 4
Thank Jitendra Singh www.newGenlives.com

Request for the permission of type 'System.Web.AspNetHostingPermission' failed

11/3/2008 9:12:56 AM
Gravatar
Total Posts 4
Thank Jitendra Singh www.newGenlives.com

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

i purchased one domain name and web space at window server with IIS 7.

after uploading mojoportal 2-2-7-6 mssqlrelease files....

i am getting following error.

 

An Error Occurred:Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source:mscorlib
Stack Trace at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Web.Hosting.HostingEnvironment.get_ApplicationID() at IIS7Injector.TraceManager.TraceEvent(TraceEventType eventType, String message) at IIS7Injector.ConfigManager.IsSkippedUrl(HttpRequest request, String ContentType) at IIS7Injector.IIS7Injector.InjectedContentStream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) at System.Web.HttpResponse.UpdateNativeResponse(Boolean sendHeaders) at System.Web.HttpResponse.Flush(Boolean finalFlush) at System.Web.HttpResponse.Flush() at mojoPortal.Web.UI.Pages.SetupHome.WritePageHeader() at mojoPortal.Web.UI.Pages.SetupHome.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

11/3/2008 9:27:45 AM
Gravatar
Total Posts 18439

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

Hi,

It looks like you must be running in Medium Trust hosting. See the documentation here for configuring it to work in medium trust.

http://www.mojoportal.com/mediumtrust.aspx

Hope it helps,

Joe

11/3/2008 9:58:08 AM
Gravatar
Total Posts 4
Thank Jitendra Singh www.newGenlives.com

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

after reading "Quick Fix for Medium Trust"  i have done following task but still getting error

1. Rename Web.config file to Web.fulltrust.config -- Done
2. Rename Web.mediumtrust.config to Web.config -- Done
3. Delete DotNetOpenId.dll from the /bin folder -- Done
4. Make sure and visit your /Setup/Default.aspx page, it should tell you a setting you need to add to Web.config for the search engine to get around a medium trust issue. -- not able to veiw this page error occured on this page.
 

The error is following:

An Error Occurred:Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source:mscorlib
Stack Trace at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Web.Hosting.HostingEnvironment.get_ApplicationID() at IIS7Injector.TraceManager.TraceEvent(TraceEventType eventType, String message) at IIS7Injector.ConfigManager.IsSkippedUrl(HttpRequest request, String ContentType) at IIS7Injector.IIS7Injector.InjectedContentStream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) at System.Web.HttpResponse.UpdateNativeResponse(Boolean sendHeaders) at System.Web.HttpResponse.Flush(Boolean finalFlush) at System.Web.HttpResponse.Flush() at mojoPortal.Web.UI.Pages.SetupHome.WritePageHeader() at mojoPortal.Web.UI.Pages.SetupHome.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


 

11/3/2008 10:13:52 AM
Gravatar
Total Posts 18439

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

I would check with your host and make sure they have the AJAX 1.0 installed in the GAC on the server. You might also try mojoportal 2.2.7.7 instead.

I am able to run it in Medium Trust on my Vista 64 dev machine with IIS 7 using the latest code.

Hope it helps,

Joe

11/3/2008 10:59:41 PM
Gravatar
Total Posts 4
Thank Jitendra Singh www.newGenlives.com

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

hi,

I have checked with my host godady they have said that AJAX is installed there in the GAC.

And Asp.net 2.0 is there with Medium trust. Still i m getting the same error.

Is there any other setting required ?

11/4/2008 9:34:36 AM
Gravatar
Total Posts 18439

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

Only other thing I can think of, is IIS 7 has 2 kinds of application pools. If your web control panel has an option for the application pool type, choose "Classic"

Hope it helps,

Joe

3/6/2010 10:25:30 AM
Gravatar
Total Posts 8

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

Hi,

I have the same problem.  See the full error description below.

I am trying to install mojoPortal on my new VDS. I created a webapplication under the default webapplication on the server. To setup a new mojoPortal website I followed the security instructions proposed by my VDS provider. This means that I created a new user and made it a member of the IIS_IUSRS group.
I then added this new user to the security settings of the virtual directory. I gave the Data subfolder extra Write permissions.
The process of creating a new webapplication with passthrough authentication pointing to this new user automatically created an Application Pool set to Managed Pipeline Mode =Integrated and Identity=ApplicationPoolIdentity.

Both the default website and the new webapplication under it are running in full trust according to IIS 7.

How do I solve this problem? I am using the mojoportal-2-3-3-9-mssql deploymentfiles together with Ms SqlServer 2008 Express. Th OS is a very recent Windows Server 2008 R2 Standard on a 64 bit VDS. The server is not part of a domain, but completely stand-alone

Johan Stringer

 

Full error in IE:

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

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

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +201
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +323
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +10864044
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +365


 

3/6/2010 10:39:09 AM
Gravatar
Total Posts 18439

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

From a quick google for this error, I suspect this post has the answer for you.

http://dbvt.com/blog/post/AspNetHostingPermission-Security-Exception-Fix-with-Ajax-in-IIS7.aspx

Hope it helps,

Joe

10/23/2012 11:37:18 AM
Gravatar
Total Posts 2

Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

joe i have de same error, in this forum dont know if the problem had resolve and how.

 

explain me please.

You must sign in to post in the forums. This thread is closed to new posts.