MVC Authentication Without Membership Provider

Posted by Akiii under ASP.NET on 2/16/2012 | Points: 10 | Views : 2520 | Status : [Member] | Replies : 4
Hi,
Please can anyone how to build a Simple Username and Password Authentication web application WITHOUT using Membership Providers ?


Thanks and Regards
Akiii




Responses

Posted by: Blessyjees on: 2/16/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

You can use normal text boxes for entering username and password. Then add code to verify this information using your database in the button click.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 2/16/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi Blessy,

I am trying to do just the same thing you mentioned, but somehow i am not being able to do the things...
My view page code is :-

 <% using (Html.BeginForm())

{ %>
Enter username :- <%= Html.TextBox("username", Model) %><br />

Enter password :- <%= Html.TextBox("password", Model) %><br />

<input type="submit" value="Submit" />
<% } %>


Now i want to login here. if there is some error then it will stay in this page stating me error message but if the login is successful then it will redirect me to a different page. Somehow i cannot be able to write the code for this...!!@@

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 2/17/2012 [Member] Bronze | Points: 25

Up
0
Down
hi,

Why are you trying like this

in the .aspx page
<div>
<div> Enter username: &nbsp; <asp:TextBox ID="txtUsername" runat="Server" /> </div>
<div> Enter Password: &nbsp; <asp:TextBox ID="txtPassword" runat="Server" /> </div>
<div> <asp:Button ID="btnLogin" Text="Login" runat="server" onclick=btnLogin_Click"/> </div>
</div>

add below code in .cs file
protected void btnLogin_Click(object sender, EventArgs e)
{
if(txtUsrname.Text !=String.empty && txtPassword.Text != string.empty)
{
// write your database code here
}
}


Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 2/18/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi blessy,
I am using ASP.NET MVC3 aspx engine, thats why the code is like that !


Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response