M6rk
M6rk

Reputation: 159

How to change page assembly in ASP.Net 2.0

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. Note: the path has been changed for security reasons. The .compiled file appears to be the linkage between the olt2.aspx file and assembly.

The contents of the ASPX file, and .compiled file:

[Olt2.aspx]
This is a marker file generated by the precompilation tool, and should not be deleted!

[olt2.aspx.cdcab7d2.compiled]
<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4"
 filehash="432defb6ed3bc6fc" flags="100000" assembly="App_Web_ekkmrelo"  
type="ASP.olt2_aspx">
<filedeps>
    <filedep name="/mysite/OLT2.aspx" />
    <filedep name="/mysite/OLT2.aspx.cs" />
</filedeps>
</preserve>

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:

[olt2.aspx.cdcab7d2.compiled]
<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4" 
  filehash="435cf6a2206e330f" flags="100000" assembly="App_Web_n1jva4in" type="ASP.olt2_aspx">
  <filedeps>
    <filedep name="/mysite/OLT2.aspx" />
    <filedep name="/mysite/OLT2.aspx.cs" />
</filedeps>
</preserve>

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.

The exception details

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.

Exception Details: System.Web.HttpException: The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.

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:

[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& completedSynchronously) +155

My questions

Is there a reason why this cannot be done? Is there a way to make this work, or pinpoint the problem?

Upvotes: 0

Views: 475

Answers (1)

M6rk
M6rk

Reputation: 159

While writing up the question for stackoverflow, I wondered if there were some dependencies in the new assembly that had changed. To answer that, I used ILSpy http://ilspy.net and sure enough there were references to these assemblies: App_Web_wlaluoz4.dll and App_Web_mkzxmd4c.dll. I copied those two assemblies into the bin folder. Using ILSpy, I checked that the newly added assemblies did not have other dependencies, and fortunately they did not.

The new version of Olt2.aspx page worked!

Upvotes: 0

Related Questions