First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« Giving a Mapped Network Drive "FullTrust... | Main | Search Blogs from the Microsoft Office 2... »

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:

/webapp
 default.aspx
 foo1.aspx
     /bin
      app.dll
      foo1.dll

We could have

/webapp
 default.aspx
     /bin
     /mysubapp
      foo1.aspx
          /bin
           foo1.dll

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:

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

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.

Tracked by:
"Specifying a different folder for code behin files in asp.net 1.1" (Hendrik Swa... [Trackback]
"Specifying a different folder for code behind files in asp.net 1.1" (Hendrik Sw... [Trackback]
"Moving the Code-Behind Assemblies/DLLs to a different folder than /BIN with ASP... [Trackback]
"Enabling the Security Tab on Windows XP File Properties" (ComputerZen.com - Sco... [Trackback]


Wednesday, October 27, 2004 3:17:38 AM (Pacific Standard Time, UTC-08:00)
Hi,

Could be useful - thanks.

One question:

How do I build "foo.dll", such that I can "plug it into" the main app?

Thanks,
Martin

Martin Naughton
Wednesday, October 27, 2004 11:08:45 AM (Pacific Standard Time, UTC-08:00)
Is it /Code? Or /Application_Code? Or will it change to /[insert_guid_here]_code :)

http://msdn.microsoft.com/asp.net/whidbey/beta2dirs.aspx

In any case, good info, thanks.
Tuesday, January 10, 2006 8:22:11 AM (Pacific Standard Time, UTC-08:00)
So how is the same thing done with ASP.Net 2 using the App_Code folder? If others have to "plug-in" versioned DLLs into your ASP.Net 2 application, how would it be best to set this out. I tried the 1.1 style which works perfectly so I could have /bin/[guid]/[version]/other.dll. Is it possible to have the same with ASP.net 2.0?
Adam
Comments are closed.

Contact

Sponsors

Hosting By

On this page...

Tags

Calendar

<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

Archives

Google Ads