locked
Parsing error: cannot read the type "webapplication2.login" RRS feed

  • Question

  • User-1305380650 posted

    Why do i get this parse error? It says that it "cannot read the type "WebApplication2.login"
    The error occurs in row 1



    Rad 1:  <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebApplication2.Login" EnableSessionState="True" %> 
    Rad 2:  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    Rad 3:  </asp:Content>





    Copy Code
    <pre><%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebApplication2.Login" EnableSessionState="True" %> 
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <p>
            Log in here</p>
        
            <asp:TextBox ID="TextBox1" runat="server" placeholder="Role/Email"></asp:TextBox>
            <asp:TextBox ID="TextBox2" runat="server" placeholder="Password"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Text="Log in" OnClick="Button1_Click" />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:LABB7ConnectionString1 %>" SelectCommand="SELECT * FROM Employee 
    WHERE Role= @Role AND Password = @Password">
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1" Name="Role" PropertyName="Text" />
                <asp:ControlParameter ControlID="TextBox2" Name="Password" PropertyName="Text" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:Label ID="Label1" runat="server"></asp:Label>
    </asp:Content>




    Expand ▼   Copy Code
    <pre>using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web;
    
    namespace WebApplication2
        {
        public partial class Login : System.Web.UI.Page
            {
            
    
            protected void Page_Load(object sender, EventArgs e)
                {
    
                }
    
            protected void Button1_Click(object sender, EventArgs e)
                {
                System.Data.DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
                if (dv != null)
                    {
                    if (dv.Count > 0)
                        {
                        Session["Role"] = TextBox1.Text;
                        Response.Redirect("Default.aspx");
                        }
                    else
                        {
                        Label1.Text = "wrong role or password";
                        }
    
                    }
    
    
    
    
    
                }
    
            }
        }
    Friday, March 19, 2021 1:14 PM

All replies

  • User1535942433 posted

    Hi kelsaf,

    According to your description,as far as I think,you could rebuild the project.There are two ways you could try:

    1.Rebuild. Build-->Rebuild Solution.

    2.Create a new project and copy your codes to it.

    Best regards,

    Yijing Sun

    Monday, March 22, 2021 2:15 AM