BuildManager allowing page inheritance

I wrote VirtualPathProvider to change the way loading aspx pages into my ASP.Net application. As part of this process, I deleted the Code-Behind files, and I simply claim that my page inherits from a specific page class. eg:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Namespace.PageClass" %>

If I do this, I get the following exception:

HttpParseException Failed to load type 'Namespace.PageClass'

I also tried the following:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Namespace.PageClass, AssemblyName" %>

This results in the following error:

HttpParseException Failed to load assembly 'AssemblyName. Make sure this is compiled before accessing the page.

When the application starts, I load the required assembly into the current application domain:

AppDomain.Current.Load(...)

, BuildManager /.... ... : -)

- ?

+3
2

- .. Inherits="MyNamespace.MyClass, MyAssembly".

appDomain AppDomain. . AppDomain.ResolveAssembly.

private Assembly myDynamicAssembly = null;

protected void Application_Start( object sender, EventArgs e )
{
      myDynamicAssembly = Assembly.LoadFrom( Server.MapPath( "MyLocation/MyAssembly.dll" ) );

      AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( CurrentDomain_AssemblyResolve );
}

Assembly CurrentDomain_AssemblyResolve( object sender, ResolveEventArgs args )
{
      if ( args.Name == "MyAssembly" )
      {
           return myDynamicAssembly;
      }

      return null;
}

. , .

+2

:

  • , .aspx Global.asax, - , . , Namespace.PageClass -.

    @Assembly, aspx .

    @Assembly Name= "assemblyname" src= "pathname" .

2. ASP.NET, IIS. ASP.NET IIS

  • "", "" ( "" + "R" )

  • INetMgr "Enter", " "

  • node, - → -

  • - node

    5. ASP.NET / .

0

All Articles