Multiple /bin folders in ASP.NET

About a week ago, Scott Hanselman posted a neat tip on deploying multiple /bin folders in an ASP.NET application. What’s really cool about this is that it lets you build a pseudo plugin architecture into your existing ASP.NET website.

Scott documents it perfectly; I’m here to tell you that I tried it, and it works. In my case the folder structure was like so:

screenshot of web folder structure

As you can see, I added a pre-compiled utility WebFileManager to the existing Linktron5000 website by dropping it into a subfolder, binaries and all. To get this to work, all I had to do was make one small change to the parent app Web.config:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="WebFileManager/bin" />
</assemblyBinding>
</runtime>

This sets up the probing path for the child assemblies. If you don’t do this, you’ll get “Assembly not found” exceptions. You also have to make a slight modification to the child .aspx page header, but this modification is safe to make in the original source file and can be permanent:

<%@ Assembly Name="WebFileManager" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebFileManager.aspx.vb" Inherits="WebFileManager.WebFileManager"%>

Note that I didn’t need the additional namespace page directive because this assembly has no namespace. Great tip, Scott. Recommended!

Related posts

My Scaling Hero

Inspiration for Stack Overflow occasionally comes from the unlikeliest places. Have you ever heard of the dating website, Plenty of Fish? Markus Frind built the Plenty of Fish Web site in 2003 as nothing more than an exercise to help teach himself a new programming language, ASP.NET. The site

By Jeff Atwood ·
Comments

Wrangling ASP.NET Viewstate

Inspired by Scott Hanselman’s recent post on ASP.NET viewstate wrangling, here’s a roundup of tips for dealing with that ornery viewstate stuff. The first rule of thumb, of course, is to turn it off whenever you can. But sometimes you can’t. I think the DotNetNuke developers

By Jeff Atwood ·
Comments

Recursive Page.FindControl

I’m currently writing my first ASP.NET 2.0 website. VS.NET 2005 is worlds better than VS.NET 2003, but I was mildly surprised to find that Microsoft still hasn’t added a recursive overload for Page.FindControl. So, courtesy of Oddur Magnusson, here it is: private Control

By Jeff Atwood ·
Comments

ASP.NET NTLM Authentication - is it worth it?

At work, we have the luxury of assuming that everyone’s on an intranet. So when it comes to identity management on our ASP.NET websites, NTLM authentication is the go-to solution. Why trouble the user with Yet Another Login Dialog when you can leverage the built in NTLM functionality

By Jeff Atwood ·
Comments

Recent Posts

Let's Talk About The American Dream

Let's Talk About The American Dream

A few months ago I wrote about what it means to stay gold — to hold on to the best parts of ourselves, our communities, and the American Dream itself. But staying gold isn’t passive. It takes work. It takes action. It takes hard conversations that ask us to confront

By Jeff Atwood ·
Comments
Stay Gold, America

Stay Gold, America

We are at an unprecedented point in American history, and I'm concerned we may lose sight of the American Dream.

By Jeff Atwood ·
Comments
The Great Filter Comes For Us All

The Great Filter Comes For Us All

With a 13 billion year head start on evolution, why haven’t any other forms of life in the universe contacted us by now? (Arrival is a fantastic movie. Watch it, but don’t stop there – read the Story of Your Life novella it was based on for so much

By Jeff Atwood ·
Comments
I’m feeling unlucky... 🎲   See All Posts