Jai
Jai

Reputation: 1

ASP.NET 4.0 Visual Studio Express - Parse error

I am getting this after

  1. compiling,
  2. made sure bin directory has the compiled DLL files.

What am I missing?

Server Error in '/' Application.

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 'WebApplication1.WebForm1'.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
Line 2:  <!DOCTYPE html>
Line 3:  Source File: /test/WebForm1.aspx    Line: 1 

Upvotes: 0

Views: 3218

Answers (2)

Steven V
Steven V

Reputation: 16595

That means that the it cannot find the type/class of WebApplication1.WebForm1. I'd look in your code behind or WebForm1.aspx.cs and see if it looks something like:

namespace WebApplication1 {
    public class WebForm1 {
        protected void Page_Load(object sender, EventArgs e) {
        }
    }
 }

I'd imagine your missing a namespace, or class name. If you can't find the code behind, I'd be tempted to recreate the page and Visual Studio should crate it for you.

Upvotes: 0

gudatcomputers
gudatcomputers

Reputation: 2882

check your namespace that is assigned to WebForm1. When I encounter this error it's typically due to me changing the namespace and not updating the line in .aspx file.

It may look like

namespace MyRenamedNamespace
{
    public class WebForm1
    {
    }
}

in which case the line in the .aspx file should read

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MyRenamedNamespace.WebForm1" %>

Upvotes: 1

Related Questions