title: How to change page assembly in ASP.Net 2.0
body: <p>I want to change one page on my ASP.Net 2.0/.Net 3.5SP1 application. The application is running on IIS6/Windows 2003.  The application is precompiled so each page is composed of a ASPX file, a .compiled file, and a separate DLL assembly.  These are mysite/olt2.aspx, mysite/bin/olt2.aspx.cdcab7d2.compiled, and mysite/bin/App_Web_ekkmrelo.dll. <em>Note: the path has been changed for security reasons.</em> The .compiled file appears to be the linkage between the olt2.aspx file and assembly.</p>
  
  <p>The contents of the ASPX file, and .compiled file:</p>
  
  <pre><code>[Olt2.aspx]
  This is a marker file generated by the precompilation tool, and should not be deleted!
  
  [olt2.aspx.cdcab7d2.compiled]
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4"
   filehash="432defb6ed3bc6fc" flags="100000" assembly="App_Web_ekkmrelo"  
  type="ASP.olt2_aspx"&gt;
  &lt;filedeps&gt;
      &lt;filedep name="/mysite/OLT2.aspx" /&gt;
      &lt;filedep name="/mysite/OLT2.aspx.cs" /&gt;
  &lt;/filedeps&gt;
  &lt;/preserve&gt;
  </code></pre>
  
  <p>I compiled a new page in my development environment and it produced a new assembly and .compiled file.  The only changes to the new version of olt2.aspx are alterations to JavaScript.  The new .compiled file:</p>
  
  <pre><code>[olt2.aspx.cdcab7d2.compiled]
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4" 
    filehash="435cf6a2206e330f" flags="100000" assembly="App_Web_n1jva4in" type="ASP.olt2_aspx"&gt;
    &lt;filedeps&gt;
      &lt;filedep name="/mysite/OLT2.aspx" /&gt;
      &lt;filedep name="/mysite/OLT2.aspx.cs" /&gt;
  &lt;/filedeps&gt;
  &lt;/preserve&gt;
  </code></pre>
  
  <p>I added the new assembly "App_Web_n1jva4in.DLL" to the bin folder, and replaced olt2.aspx.cdcab7d2.compiled with the new version.  The security on the newly added DLL matches other DLL in the bin folder. But when I attempt to open OLT2.aspx I get an error (see below).  I have tried stopping the application pool, deleting the temp asp files. If I replace olt2.aspx.cdcab7d2.compiled with the original version, the page loads.  </p>
  
  <h2>The exception details</h2>
  
  <p>The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.Web.HttpException: The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.</p>
  
  <p>Source Error: </p>
  
  <p>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.  </p>
  
  <p>Stack Trace: </p>
  
  <p>[HttpException (0x80004005): The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.]
     System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +8844526
     System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
     System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
     System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
     System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
     System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
     System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
     System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155</p>
  
  <h2>My questions</h2>
  
  <p>Is there a reason why this cannot be done?  Is there a way to make this work, or pinpoint the problem?</p>