364,088 Members | 5420 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Server error in '/' Application

Parul Vinod
P: 33
I am using Visual Studio 2008; in that am working on a project which is of type Website of ASP.net.My project is working fine till three webpages, but for 4th one it is showing Server error in '/' application. Description of the error is as follows:
Parser Error
Description: An error occured 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 'WebApplication1.Webform4'
Source Error:
Expand|Select|Wrap|Line Numbers
  1. Line 1:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Webapplication.WebForm4"%>
Version information Microsoft .NET version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Jan 22 '12 #1
Share this Question
Share on Google+
6 Replies


Joseph Martell
Expert 100+
P: 165
It sounds like you renamed the class WebForm4 in the code behind file.

This line:
Expand|Select|Wrap|Line Numbers
  1.     Line 1:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Webapplication.WebForm4"%>
tells the compiler where the code lives to handle the events of this page. If you rename a class without updating this line then you break the link and errors like this one result.
Jan 23 '12 #2

Parul Vinod
P: 33
But i have renamed all the classes in the earlier three webforms and the same line is there in respective webforms and none of the webforms are showing any error. Further more this line is self generated, i think user is not supposed to make changes into it.
Jan 24 '12 #3

Joseph Martell
Expert 100+
P: 165
If your other three forms are functioning correctly then I guarantee that the class specified by the Inherits attribute is valid and exists in the file specified in the CodeBehind attribute for those respective pages.

You are correct, the VS IDE is supposed to take care of all of the wiring back and forth but it can mess up. Your page is expecting a class named WebForm4 in a file named WebForm4.aspx.cs. If that class is not found in that file then the parse error you saw is the result.

I think there are only 3 options to fix your error:
  1. Modify the <%@ Page element in your aspx source - this is probably the fastest way to fix your problem.
  2. Change your class name in WebForm4.aspx.cs to WebForm4 - if this is a partial class (like it was in my test solution in VS 2008) then you have to make sure to change the name on the rest of the class definition as well.
  3. Delete WebForm4 and start a new page so that you start with a working link between the aspx file and the CodeBehind file. This option isn't bad if you haven't done much on the form yet. If you have done a lot of work then it can be quite a pain to reproduce this way.
Jan 24 '12 #4

Parul Vinod
P: 33
I have tried the third option many times; but i still get the same error. About first 2 options i don't know what to change.
Jan 25 '12 #5

Joseph Martell
Expert 100+
P: 165
What did you rename the WebForm4 class to?
Jan 25 '12 #6

Parul Vinod
P: 33
I havn't renamed the Webform4 class
Jan 27 '12 #7

Post your reply

Help answer this question



Didn't find the answer to your .NET Framework question?

You can also browse similar questions: .NET Framework