New files added to existing project in sub-folder cause "Could Not Load Type" error message.

Posted on 2005-05-10
Last Modified: 2008-01-09
I have an existing ASP.NET project.  

I wanted to create a new secure portion for the website.  So in my VS.NET project I created a subfolder and created new web config file with correct authorization and authentication setup.  I put new login.aspx and default.aspx into this folder.  I made the new folder an application root so it could have it's own authentication scheme.  

For testing I make default.aspx of subfolder the start page.  All that is fine.

When I try to run ANY of the files in the new subfolder I am getting the following compile error:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'MyApplication.Login'.

Source Error:

Line 1:  <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Login.aspx.vb" Inherits="MyApplication.Login"%>
I have determined that if I move the files into the root of the web I do not get an error.  But I get this Could Not Load Type error when I put the new files into the new subfolder.  

Can someone tell me how to get ASP.NET to recognize and use my sub-folders?

Seth B Spearman
Question by:sethspearman
    LVL 33

    Assisted Solution

    once you make it a new application in IIS, it is a NEW application, and will also need a /bin directory with the correct assemblies added.  You really should be using two separate projects if you are doing this, one project isn't meant to span two applications.  Also, I do not see why you cannot just secure the admin pages in your existing project.
    LVL 1

    Author Comment


    Thanks for your response.  Lets start from scratch.  Let's say that I have an application that is for displaying photos (like nGallery).  And for your normal users you connect to the web root.  But I also want an ADMIN application for managing the application.  I want admin users to get to THAT application by using  Of course, that folder will require authentication.  Once authenticated you can access each page.

    How would you set that up in VS.NET (or any dev environment for that matter)?

    LVL 33

    Expert Comment

    ok, so the main application has no authentication, just admin pages?

    I'd set up forms authentication, and just secure the "Admin" folder.  You can keep it all in the same application.
    LVL 1

    Author Comment


    The web root is the "PUBLIC" application that requires no authentication.
    Then there should be an ADMIN folder hanging off the web root that DOES require authentication.  (example(


    It just seems silly to me that creating sub-folders in a ASP.NET application would be so hard.   Other than folders, how can I organize an application without creating a bunch of little projects if the applicaton is large.

    Can you please give specifics on how to set this up?

    LVL 9

    Accepted Solution

    Setting up subdirectories is actually quite simple.  You made it more difficult by making the subdirectory an application.  When you tell IIS a virtual directory is an application it tries to load the .dll(s) it thinks the application needs.  If you don't tell IIS the directory is an application it presumes the directory is part of the application in the parent directory.  This is what you want.  If you really wanted to have the subdirectory be an application you would have to set up a whole new VS.NET project for it.

    raterus is correct.  The best way to do this is to secure only the "Admin" folder.  Check out the following article on securing subdirectories:
    LVL 1

    Author Comment

    Thanks for the help.

    I removed the folder as an application.  Put the Authenication settings back into the root of the web.config (which is why I moved it in the first place) and VOILA.

    Thanks for your help.  And REALLY thanks for the URL.  It is exactly what I needed.


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now