views:

132

answers:

3

When I try to access my ASP.NET password recovery page, I get the following 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 'RugbyClubWebApplication.ForgotPassword'.

Source Error:

Line 1:  <%@ Page Language="C#" MasterPageFile="~/SubMaster.Master" AutoEventWireup="true" CodeBehind="ForgotPassword.aspx.cs" Inherits="RugbyClubWebApplication.ForgotPassword" Title="Untitled Page" %>
Line 2:  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
Line 3:  </asp:Content>

Source File: /Rugby/ForgotPassword.aspx Line: 1

Any ideas?

A: 

You may be able to fix this by simply cleaning and rebuilding the entire solution.

nbolton
A: 

This can sometimes happen when file or project names change and class or namespaces aren't updated. Is the name of the class defined in ForgotPassword.aspx.cs actually ForgotPassword, and is it in the namespace RugbyClubWebApplication?

i.e. you should have the following in your class file:

namespace RugbyClubWebApplication
{
    public class ForgotPassword
    {
        ...
    }
}

Also, if you're using Visual Studio, is the Default Namespace of the project which contains this class correct? This is found in the Properties page of the project.

Graham Clark
A: 

Assuming this to be an ASP.NET 2.0 Website project and that the class name and file names are correct, you should try replacing the CodeBehind attribute of the @Page directive with the CodeFile attribute, instead. In .NET 2.0 and above, the CodeBehind attribute exists only for backward compatibility and you should be using the CodeFile attribute along with the Inherits to specify a code behind file along with class name.

Cerebrus