Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

i need to design a login. When the user enters his username, the text that has been inputted must automatically search through the database then when he enters his password and clicks submit, he should be redirected to User.aspx if the password matches the username.
here are the textboxes and button:
<asp:TextBox CssClass="input" ID="Username" runat="server" placeholder="lynda" >

<asp:TextBox CssClass="input" ID="Password" runat="server" placeholder="Password" TextMode="Password">

<asp:Button ID="Button1" CssClass="button" runat="server" Text="Submit" OnClick="Button1_Click" />

here is the database:
XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />
                <asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
                <asp:BoundField DataField="LoginRetrieveQuestion" HeaderText="LoginRetrieveQuestion" SortExpression="LoginRetrieveQuestion" />
                <asp:BoundField DataField="LoginRetrieveAnswer" HeaderText="LoginRetrieveAnswer" SortExpression="LoginRetrieveAnswer" />
                <asp:BoundField DataField="Client" HeaderText="Client" SortExpression="Client" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [ID], [Username], [Password], [LoginRetrieveQuestion], [LoginRetrieveAnswer], [Client] FROM [LoginTable]"></asp:SqlDataSource>


ive tried alot of ways but i just couldnt do it. Your help is needed
Posted

1 solution

Please, stop reinventing the wheel.
There is a much simpler, much more effective, and much more secure way of doing this: MSDN: Introduction to Membership[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900