Moving the Code-Behind Assemblies/DLLs to a different folder than /BIN with ASP.NET 1.1
Apparently there's a number of places online that say this can't be done. We needed to be able to add pages to an existing application that were basically "sub-applications," and they'd have their own /bin folder, but still be in the same VDIR and participate in the same IIS Application.
So instead of:
We could have
If you try this directory layout as is, you'll get a "Parser Error" as ASP.NET freaks out due to its inability to find the code-behind for foo1.aspx.
However, if you add a private probingPath to your web.config:
<probing privatePath="mysubapp/bin" />
And, tell your ASPX page where it can find it's code-behind file BEFORE the System needs it for the Inherits= attribute in the @Page directive:
<%@ Assembly Name="Foo1" %>
<%@ Import Namespace="FooNamespace" %>
<%@ Page language="c#" Trace="true" Codebehind="Foo1.aspx.cs" AutoEventWireup="false" Inherits="FooNamespace.FooWebForm1" Debug="true"%>
You'll be all set. Slick. Of course, this is all ASP.NET 1.1, and everything changes with 2.0 and the "/Code" directory, but it's still slick IMHO, and allows for a level of flexibility that I haven't seen before. It also keeps your man/bin nice and tidy if you've got folks "plugging in" other pages to your web app.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
In any case, good info, thanks.
Comments are closed.
Could be useful - thanks.
How do I build "foo.dll", such that I can "plug it into" the main app?