Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've deviced a workaround for the mentioned problem. It seems that readers of this question have not faced this problem therefore not able to suggest a possible solution. Since people using shared hosting can face this problem and may look for a solution, they can utilize this workaround.</p> <p>Edit: I've decided not to accept my answer immediately. I look forward for comments on this answer and will decide in a few days time accordingly.</p> <p>This breaks my PageParser.GetCompiledPageInstance approach, but the impact is minimal and I can easily switch to the original approach when hosting in a full trust environment.</p> <p>The change is in two places:</p> <p>1) In the ExecutePage method:</p> <pre><code>public static string ExecutePage(SLActionInfo actionInfo, string url) { var context = actionInfo.Context; var sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); // The original approach is commented out. // 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); // The new approach: // Add actionInfo to the Items collection so that any page executing in the context of this request can read it. Context.Items.Add("SLActionInfo", actionInfo); // Now execute the page by providing its url. context.Server.Execute(url, htw, true); return sw.ToString(); } </code></pre> <p>2) The other change is within the SLPageBase.ActionInfo property:</p> <pre><code>public SLActionInfo ActionInfo { get { return (SLActionInfo)Context.Items["SLActionInfo"]; // Commented out the old approach. // return _actionInfo; } } </code></pre> <p>You can see how easy it is if I want to revert to the old (and prefered) approach. Just uncommenting a few lines here and commenting a few lines there will do the trick. Rest of the system will remain unimpacted.</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