Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: 'LogIn' is not a member of 'ASP.account_login_aspx'. 1

Status
Not open for further replies.

Blueie

Technical User
May 12, 2012
72
GB
Hello

What does it mean, please, when Visual Studio gives the following error:

Error 2'LogIn' is not a member of 'ASP.account_login_aspx'. C:\Users\Steve\Documents\Visual Studio 2013\WebSites\WebSite5copy131014\Account\Login.aspx 64


This is the code the error is referring to:

Code:
<%@ Page Title="Log in" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Login.aspx.vb" Inherits="Account_Login" Async="true" %>

<%@ Register Src="~/Account/OpenAuthProviders.ascx" TagPrefix="uc" TagName="OpenAuthProviders" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

    <style>
        .navbar-inverse
        {
            background-color: #BD2CBB !important;
        }
    </style>

    <h2><%: Title %>.</h2>

    <div class="row">
        <div class="col-md-8">
            <section id="loginForm">
                <div class="form-horizontal">
                    <h4>Use a local account to log in.</h4>
                    <hr />
                    <asp:PlaceHolder runat="server" ID="ErrorMessage" Visible="false">
                        <p class="text-danger">
                            <asp:Literal runat="server" ID="FailureText" />
                        </p>
                    </asp:PlaceHolder>
                    <div class="form-group">
                        <asp:Label runat="server" AssociatedControlID="UserName" CssClass="col-md-2 control-label">User name</asp:Label>
                        <div class="col-md-10">
                            <asp:TextBox runat="server" ID="username" CssClass="form-control" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="username"
                                CssClass="text-danger" ErrorMessage="The user name field is required." />
                        </div>
                    </div>
                    <div class="form-group">
                        <asp:Label ID="Label2" runat="server" AssociatedControlID="password" CssClass="col-md-2 control-label">Password</asp:Label>
                        <div class="col-md-10">
                            <asp:TextBox runat="server" ID="password" TextMode="password" CssClass="form-control" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="password" CssClass="text-danger" ErrorMessage="The password field is required." />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <div class="checkbox">
                                <asp:CheckBox runat="server" ID="RememberMe" />
                                <asp:Label ID="Label3" runat="server" AssociatedControlID="RememberMe">Remember me?</asp:Label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <asp:Button ID=btnLogin runat="server" OnClick="Login" Text="Log in" CssClass="btn btn-default" />
                        </div>
                    </div>
                </div>
                <p>
                    <asp:HyperLink runat="server" ID="RegisterHyperLink" ViewStateMode="Disabled">Register</asp:HyperLink>
                    if you don't have a local account.
                </p>
            </section>
        </div>

        <div class="col-md-4">
            <section id="socialLoginForm">
                <uc:openauthproviders runat="server" id="OpenAuthLogin" />
            </section>
        </div>
    </div>
</asp:Content>

I can't even see the error for LogIn (with a capital I) or have a file called 'ASP.account_login_aspx'. How can I best resolve this, please?

Thanks!
 
check your code file
Code:
CodeFile="Login.aspx.vb"

Maybe in it you are referring to something named "LogIn
 
Hello jbenson

Thank you for our reply.

In my aspx file (the Log in form), I have:

Code:
<%@ Page Title="Log in" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Login.aspx.vb" Inherits="LoginPage" Async="true" %>]

and in the aspx.vb file itself, I have:

Code:
Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports Microsoft.Owin.Security
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web.Security
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.OleDb

Partial Public Class LoginPage
    Inherits Page

    Dim NewWindow As Object

    Protected Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load
        RegisterHyperLink.NavigateUrl = "Register"
        OpenAuthLogin.ReturnUrl = Request.QueryString("ReturnUrl")
        Dim returnUrl = HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
        If Not [String].IsNullOrEmpty(returnUrl) Then
            RegisterHyperLink.NavigateUrl += "?ReturnUrl=" & returnUrl
        End If
    End Sub

    Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        AddHandler btnLogin
        Dim connect = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=|DataDirectory|students.mdb;"

        Dim query As String
        query = "Select Count(*) From university Where username = ? AND [password] = ?"
        Dim result As Integer = 0
        Using conn As New OleDbConnection(connect)
            Using cmd As New OleDbCommand(query, conn)
                cmd.Parameters.AddWithValue("", username.Text)
                cmd.Parameters.AddWithValue("", password.Text)
                conn.Open()
                Session("User") = username.Text
                result = DirectCast(cmd.ExecuteScalar(), Integer)
            End Using
        End Using
        If result > 0 Then
            Response.Redirect("upload.asp")
        Else
            FailureText.Text = "Invalid credentials"
        End If
    End Sub
End Class

The error is here: AddHandler btnLogin

I am hoping that once the form can validate the user that the user will be redirected to 'upload.asp'?

Many thanks again.
 
Code:
AddHandler btnLogin
is incorrect syntax
You need need to add a handles clause to your btnLogin_Click event instead
Code:
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) [COLOR=#EF2929][b]handles btnLogin.Click[/b][/color]
 
Thank you, jbenson001.

Your code removed that
Code:
AddHandler btnLogin
code error that I was getting.

I am getting this error: 'Login' is not a member of 'ASP.login_aspx'. This refers to my Login.aspx file. I have done a 'Entire Solution' Edit | Find and get no results for 'ASP.login_aspx', so I can only assume it is a 'false' error.

Many thanks again for your reply and my apologies for the delay in getting back to you.

Blueie
 
Without seeing your entire project, it's hard to say. At this point I would say to start a new project from scratch and move your code from this one into it as necessary
 
I have just this minute managed to identify the error. It had nothing to do with what VS was telling me, but was related to this line:

Code:
 <asp:Button ID=btnLogin runat="server" OnClick="btnLogin_Click" Text="Log in" CssClass="btn btn-default" />

This seems to be what it should be and not
Code:
OnClick="Login"
which is the way I had it.

Thanks again.

Blueie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top