?
Solved

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

Posted on 2005-05-10
6
Medium Priority
?
478 Views
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
0
Comment
Question by:sethspearman
  • 3
  • 2
6 Comments
 
LVL 33

Assisted Solution

by:raterus
raterus earned 400 total points
ID: 13971051
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 VS.net 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.
0
 
LVL 1

Author Comment

by:sethspearman
ID: 13971104
raterus,

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 www.myapp.com/admin.  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)?

Seth
0
 
LVL 33

Expert Comment

by:raterus
ID: 13971199
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:sethspearman
ID: 13971245
Actually,

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(www.myapp.com/ADMIN/default.aspx).

BTW,

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?

Seth
0
 
LVL 9

Accepted Solution

by:
BurntSky earned 1600 total points
ID: 13971607
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:
http://www.theserverside.net/articles/showarticle.tss?id=FormAuthentication
0
 
LVL 1

Author Comment

by:sethspearman
ID: 13973116
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.

Seth
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 www.johnchapman.name could not pull conte…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

809 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