Make sure that the class defined in this Code File matches the "inherits" attribute, and the base class (such as page or usercontrol) of this class extension is correct.

Source: Internet
Author: User

We hereby record this issue

Caused by the copy ASPX page

After the copy operation, the original class name is different from your current file name. loginapi. aspx

public partial class yuanlai : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
object obj = Request.Cookies["username"];
if (obj == null)
{
Response.Redirect("Login.aspx");
}
}
}

  

Modify

public partial class LoginAPI: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
object obj = Request.Cookies["username"];
if (obj == null)
{
Response.Redirect("Login.aspx");
}
}
}

  

At this time, an error will be reported.

A headache that has plagued me for a long time. Make sure that the class defined in this Code File matches the "inherits" attribute and that the base class (such as page or usercontrol) of this class extension is correct.

Solution:

Modify the inherits attribute in the first line of code in aspx to be the same as your class name.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoginAPI.aspx.cs" Inherits="LoginAPI" %>

OK Problem Solving


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.