Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

.NET 2.0 virtual directory problem

Back to Forum: Tech Off
  • User profile image
    Darrell

    Hi

    I have two web sites defined in windows 2003 IIS. The first contains the App_Code, App_Data, etc folders for .NET 2.0 framework. I have put some code into the App_Code folder, which I don't really want to generate a dll for. I now want to re-use this code in the second web server, so I thought, logically, that I could simply create a virtual directory and point it to the physical folder that is in the first website.

    However, I now get the following error

    The path '/App_Code/' maps to a directory outside this application, which is not supported

    Has anyone got any idea how I can get around this without having to create a dll from the source code, as this is a right royal pain in the behind Smiley

    Thanks

    Darrell

  • User profile image
    hackman_3vil​Guy

    Why can't you just copy the source file to a new App_Code directory on the 2nd virtual server?
    ____________

  • User profile image
    Darrell

    The only problem with this is it means I have duplicated code all over the place. Now with two web sites this isn't that much of an issue, however, the client I am working for has over 40 different web sites, all of which could benefit from re-using the code that I have created in this method.

     

    Any other ideas

    Thanks

    D

  • User profile image
    hackman_3vil​Guy

    I don't think it can be done without a DLL.
    In the web.config file there is a section codeSubDirectories:

    <configuration>
       <system.web>
          <compilation>
            <codeSubDirectories>
              <add directoryName="/mysite/code/mySubDir"/>
            </codeSubDirectories>
           </compilation>
       </system.web>
    </configuration>


    However, the paths have to be relative to the App_Code file of the application.
    It shouldn't take you too long to make a DLL although you still have multiple copies of the DLL in App_Bin directories unless you put it in the GAC? or whatever you have to do I think.
    ____________

  • User profile image
    rprimrose

    Perhaps enabling parent paths on the website will work. What you want to do is really what dlls are for. Keep you code in one place and deploy multiple dlls.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.