Organizing pages in subdirectories of main directory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

At the moment I'm an asp.net rookie. I'm using Visual Studio .net 2003.
I get the error "An error occurred during the parsing of a resource required...
Could not load type 'myApp.main'.

This error occurs in pages located in a subdirectory beneath the root level in my application. So for example I want to create a folder called pages and then place content in this subdirectory so that I can secure those pages using a web.config file.

Do I need to change the line below in some way, or do I need to change something elsewhere
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="main.aspx.vb" Inherits="myApp.main"%>
 
Try compiling your web application. When a web application compiles, an
assembly binary is created from the code-behind pages. It could be that the
system does not have a knowledge of the myApp.main in the assembly.

Charlie Dison said:
At the moment I'm an asp.net rookie. I'm using Visual Studio .net 2003.
I get the error "An error occurred during the parsing of a resource required...
Could not load type 'myApp.main'."

This error occurs in pages located in a subdirectory beneath the root
level in my application. So for example I want to create a folder called
pages and then place content in this subdirectory so that I can secure those
pages using a web.config file.
Do I need to change the line below in some way, or do I need to change something elsewhere?
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="main.aspx.vb"
Inherits="myApp.main"%>
 
Are you using the correct namespace/class names? "myApp.main" should always
change to reflect the Namespace.Class of the code-behind class.



Charlie Dison said:
At the moment I'm an asp.net rookie. I'm using Visual Studio .net 2003.
I get the error "An error occurred during the parsing of a resource required...
Could not load type 'myApp.main'."

This error occurs in pages located in a subdirectory beneath the root
level in my application. So for example I want to create a folder called
pages and then place content in this subdirectory so that I can secure those
pages using a web.config file.
Do I need to change the line below in some way, or do I need to change something elsewhere?
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="main.aspx.vb"
Inherits="myApp.main"%>
 
Can you explain in a little more detail how I should check my namespace/class names? What action should I take to check this? Thanks in advance.
 
Hello Charlie,

Thanks for posting in the group.

Based on your description, it seems that VS.NET IDE can't find myApp.main
when compiling your project.

Generally speaking, "Inherits" attribute identifies the class from which
the page derives. In Visual Studio, this points to a class in the project
assembly (.dll), as shown in the diagram above.

I tested it on my side as you described. Here are my testing steps:

1) Create a web application on local machine named WebApplication2.
2) The Page directive of default web form WebForm1.aspx is:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication2.WebForm1" %>
3) Create a subfolder named NewFolder1 by right click project
name(WebApplication2)->Add->New Folder in Solution Explorer.
4) In the subfolder, create a new web form named Webform1.aspx also.
5) The Page directive of WebForm1.aspx in the subfolder is:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication2.NewFolder1.WebForm1" %>

So I think you may need to change Inherits attribute to
"myApp.SubFolderName.main"

If the problem still can't be resolved, could you please post here step by
step how you create this asp.net web application here? So we could tell
which step may contain errors.

If there is anything unclear, please feel free to post here. Thanks.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top