Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I process a request for a web page of a pre-compiled web application which is referenced in another web application?
    text
    copied!<p>Our company would like to give a pre-compiled version of our web application to a 3rd party so they can add their own pages and modules to it. In trying to accomplish this, I've so far done the following:</p> <ol> <li>Compiled our main web app as a Web Deployment Project </li> <li>Created a POC web app which references the DLL resulting from step 1 above.</li> </ol> <p>I then added the following static method to our main web app, which should hopefully process requests to its pre-compiled aspx pages:</p> <pre><code>public static bool TryProcessRequest(HttpContext context) { string rawUrl = context.Request.RawUrl; int aspxIdx = rawUrl.IndexOf(".aspx"); if (aspxIdx &gt; 0) { string aspxPagePath = rawUrl.Substring(0, aspxIdx + 5); string aspxPageClassName = aspxPagePath.Substring(1).Replace('/','_').Replace(".aspx",""); Assembly website = Assembly.GetAssembly(typeof(MCLLogin)); Type pageClass = website.GetType(aspxPageClassName); ConstructorInfo ctor = pageClass.GetConstructor(new Type[] { }); IHttpHandler pageObj = (IHttpHandler)ctor.Invoke(new object[] { }); context.Server.Execute(pageObj, context.Response.Output, false); //alternative: invoking the page's ProcessRequest method - same results //System.Reflection.MethodInfo method = pageClass.GetMethod("ProcessRequest"); //method.Invoke(pageObj, new object[] { context }); return true; } return false; //not handled } </code></pre> <p>I am then calling this method in the <code>ProcessRequest()</code> method of a <code>HttpHandler</code> of the POC web app whenever I want our main web app to handle the request. This code indeed successfully instantiates a page of the correct class and starts to process the request.</p> <p><strong>The problem:</strong> Code in my <code>Page_PreLoad</code> handler throws an exception because <code>Page.Form</code> is <strong>null</strong>. I've also found out the <code>Page.Controls</code> collection is <strong>empty</strong>. </p> <p>What am I doing wrong? Should I go down a different path to achieve this?</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