Note that there are some explanatory texts on larger screens.

plurals
  1. POPageParser.GetCompiledPageInstance is throwing a SecurityException – how to fix this?
    text
    copied!<p>Background: I have created a custom HttpHandler which executes a particular command based on user posted parameters. Since JQuery Ajax is heavily used in my website, I have adopted content pages approach in which I execute an aspx page containing the content for the container page being viewed by user. As of now I'm using Godaddy shared hosting and because the site is in its infancy, I cannot go for dedicated/virtual server.</p> <p>Everything is working fine on my PC, but not on server. I'm getting this error:</p> <pre> [SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Web.UI.PageParser.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context) +46 SL.Controller.Commands.CommandHelper.ExecutePage(SLActionInfo actionInfo, String url) +95 SL.Controller.Commands.ProductCommand.Execute(SLActionInfo actionInfo) +32 SL.Controller.CommandFactory.ExecuteCommand(HttpContext context) +224 SL.Controller.DefaultHttpHandler.ProcessRequest(HttpContext context) +20 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 .... </pre> <p>Strange thing: Server.Execute(string virtualUrl) is working, but PageParser.GetCompiledPageInstance is not.</p> <p>Why am I using PageParser.GetCompiledPageInstance and not Server.Execute(string url)? Because of the following code:</p> <pre> public static string ExecutePage(SLActionInfo actionInfo, string url) { var context = actionInfo.Context; var sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); IHttpHandler handler = PageParser.GetCompiledPageInstance(url, context.Server.MapPath(url), context); if (handler is SL.UI.SLPageBase) ((SL.UI.SLPageBase)handler).ActionInfo = actionInfo; context.Server.Execute(handler, htw, true); return sw.ToString(); } </pre> <p>Since my content pages derive from SLPageBase (subclass of Page) that has a property ActionInfo which needs to be set in this ExecutePage method, I'm using PageParser approach.</p> <p>I don't know how to get rid of this error without breaking my PageParser approach.</p> <p>Any help will be appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload