How to Create Login Page in Asp.Net Web Form With Sql DataBase
ฝัง
- เผยแพร่เมื่อ 22 ก.ย. 2024
- 🍒 Related Videos
Asp.Net Core MVC Tutorials: • Asp.Net Core MVC Tutorial
MVC Login & User Registration: • Asp.Net Core MVC & Ide...
CRUD in Asp Web Form: • C# Asp.Net Web Form CR...
Bind GridView in Asp Web Form: • Asp.Net Gridview : Bi...
GridView CRUD in Asp Web Form : • Asp.Net Web Form Gridv...
jQuery DataTable Playlist with Asp Web Form: • jQuery Datatable and A...
More Asp.Net Web Form Tutorials: • Asp WebForm MVC Tutori...
📂 GitHub Repository
► goo.gl/24sG2F
💖 Buy me a Coffee
➤ bit.ly/3L36ut4 (PayPal)
➤ bit.ly/3VF0iPT (Razorpay)
🔗 Find me in
Udemy : bit.ly/3RtyQSB
Facebook : / codaffection
GitHub : github.com/cod...
Discord : / discord
Twitter : / codaffection
---
How to Create Login and Logout Page in Asp.net using SQL server database.
The tutorial discusses the following points :
- Create Login Page in asp.net webform
- Logout in Dashboard( Home Page)
Login-Logout System(user authentication) is implemented using a session.
#AspNet #CodAffection
goo.gl/bPcyXW : Buy me a Coffee
bit.ly/30fPDMg : AspNet Core MVC Tutorials
bit.ly/403lUVC : MVC Login & User Registration
bit.ly/2Z7PI3e : CRUD in Asp Web Form
bit.ly/3Z5uWUR : jQuery DataTable Playlist with Asp Web Form
bit.ly/2TA9N14 : GridView CRUD in Asp Web Form
bit.ly/2MlkMuM : Login in Asp Web Form
bit.ly/3yTsztF : More AspNet Web Form Tutorials
I've seen thousands of videos, and yours is the only one that helped me, thanks (google translate)
Hi, for my project, it keep ahowing error and pointing to the sqlCon.Open(), any solution for me😭
im trying to resolve the issue with this too.. its something to do with the data source..
Thanks sir, aapne bahut hi simple taraikee se btaya .... Thanks for helping me
there is an error in int count = Convert.ToInt32(sqlCmd.ExecuteScalar());
7 years later I'm still using the video. S/O to you
MAN!!! THANK YOU VERY MUCH!! This is just miracle!!! Could you please post more videos about ASP.NET Webforms?
I'm getting an error as invalid object name 'userDetails' in the execution time and at the line of int count=Convert.ToInt32(cmdExecuteScalar());
Can anyone please help.....
up
Thank you sir ..helps alot for beginners
you are welcome. let me know if you have any asp.net related topic suggestion for future videos.
Can u add a video like after login page...showing the user details.on that page we edit the details like that.
Best coding channel🔥👌
Exactly what I was looking for! Thank you so much!
Glad you found the video helpful.
Thank you very much! You solved all the problems for my school project!!
You are welcome.
Yes me too
Hi sir, plz guide why u type cast to execute scalar method
Thanks a lot, successfully completed my page
Thanks for video
I am getting error as System.InvalidOperationException: 'ExecuteScalar: Connection property has not been initialized.'
plz help
Try to add this line in top of Login.aspx.cs
using System.Data.SqlClient;
Works! thanks! ... Other published methods on the net failed: employed disabling of anonymous users, but by doing so, login page was also not allowed on 2019 visual studio.
hey guys ive done everything just the same, but when i open my login page in google and fill in the credentials to login i get this error in my visual studio 2019 : System.ArgumentException: 'Invalid value for key 'integrated security'.'
therefore i cant get trough the login page
Hello, need assistance on lblerrormessage.visible = false;. Why its still showing up even if it is on page load
Thenk u! Thenk U! it worked now I can add more features
package konsa selct kiya tha project create karteh watq
I have a quick question. so if I enter the url " .../Dashboard.aspx" directly in my navigator, it will still ask for a username and password ? or i would be able to access the page with no problemes ?
Very Helpful
i am getting an error like : " object reference not set to an instance of an object.'" near " lblErrorMessage.Visible = false; " help me with this
Sir, may I ask if Session["username"] can be any name? Or is there id called username to use Session?
Great our Job, What If I want to create a Connection Class and then call the Process in each page where I Need to Execute an SQL query?
Excellent work . It is very helpful for me
what if i have to retrieve only certain database....like for Admin to redirect to another page??
sir your video is very helpful for me
Thank you so much
Dear Sir,
I follow the scenario and the web works properly.
But, if I input the incorrect account which is not existed in the database, the login goes wrong.
How to solve this symptom? (The "Authorize" Action should be modified! I guess.)
I'm having problem in SQL part like...you didn't explain that part so well and I'm confuse af... how the table was ready and everything ?
Thank you for your help and your explanations!
Thank you very much. Just what i'm looking for
keep going bro thx
boss you are the best
thank you.
your course is soooo helful ..... thank you so so much
thanks for the support
Great video
Thank you for doing this. Great job, sir!
I love your videos. Thank you!
When I right-click - properties on the btnLogin and double-click the Click event, I do not get a Login.asps.c page to edit the code. I am getting a Login.aspx.vb page. What am I doing wrong? If I click on Design I see the page correctly. I am just not getting the right page to add the click event code.
so you are working on VB.Net
I am working (practice) on Asp.Net
Best voice of the youtube!
Thank you for the wonderful feedback! :) I'm humbled.
Thank you dear. very much helpful
My pleasure 😊
Hi, do you have a method of encrypting the password or is your method secure enough?
the method isnt secure for encryption use authentication and security classes they are a bit complex but most secure
@@syedwasay3087 i plan to use sha1 on submit login and register. this would be an accurate approach?
I used MD5 once worked like a charm, it is really easy to implement too.
@@faruksmajlovic6773 ty for your feedback
Thanks a lot, this was very helpful to me :-)
I'm glad you fount the video helpful.
Hi, thanks for your tutorial !
Do you have any videos about login modules with encrypt password ?
awesome job sir,very helpful
Thank you for sharing this! Very informative. However I see that while using this query, the password can be CAPS or small letters, and it will still permit user login unless the database table tblUser has collation set to be case sensitive.
Good point!
thanks, i found this video very useful. nice and simple.
Great Tutorial!
Thanks for the comment
Muchas gracias papu, me ha servido muchisimo, mis respetos :3
Many many thanks for your amazing tutorial.
Watch other tutorials this is out dated and considered bad practice nowadays.
@@knowiz8071 I needed this for my University assignment.
Hi, How are bro?
I have a question for you, I have VB.net windows form application with MYSQL database. Is it possible to connect Firebase Database instead of SQL server with VB.NET desktop application?
thats visual basic LOL
Thank you
Thanks bro!!!
Great tutorial :D
Great you help me so much
Thanks
Where do you get the @Data Source line from? (7:30 in the video)
Answer is here : stackoverflow.com/a/4879175/4133590
Hey i know this is a long-ago video but do you have a registration and forget password tutorial
Nice video bro but plz show output also after some steps it will help u understand... 👍
Thank you very much
This was great help! Thank you :)
you are welcome. let me know if you have any video suggestion regarding asp.net.
Thanks, Very useful
Excellent ! thanks !
Thank you Sir
How to export this SQL database to CSV? Can you do a tutorial of it?
Thank you very much!
Great view
Well done. Thank you.
Thanks man.
thanks you so much sir!
Thank you soo much.. god bless
Thank you.
LEGEND
Thank you.
TY
A big Thanks
T H A N K S ! ! !
excellent tutorial
thank you :)
int count = Convert.ToInt64(SqlCmd.ExecuteScalar());
this line error will be occur.how to modify line
check you db connection string or try with break point.
CodAffection tq.
HI bro, how do you hide the password? cuz your video shows the password
Hi I am beginner and have NO knowledge of ASP.NET
I viewed the video and followed the steps.
However when clicked on login, got below error.
Please help me here.
Error:
Server Error in '/' Application.
ExecuteScalar requires an open and available Connection. The connection's current state is closed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is closed.
Source Error:
Line 25: sqlcmd.Parameters.AddWithValue("@Username", txtUserName.Text.Trim());
Line 26: sqlcmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());
Line 27: int count = Convert.ToInt32(sqlcmd.ExecuteScalar());
Line 28: if (count == 1)
Line 29: {
Source File: Q:\Prod\myproject\loginpage\loginpage\login.aspx.cs Line: 27
Stack Trace:
[InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is closed.]
System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +2378748
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +91
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
System.Data.SqlClient.SqlCommand.ExecuteScalar() +180
loginpage.WebForm1.btnlogin_Click(Object sender, EventArgs e) in Q:\Prod\myproject\loginpage\loginpage\login.aspx.cs:27
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9659822
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0
Please Check Your Sql Server Connection String
Sir, It is exactly same as provided by you.
as below:
using (SqlConnection SqlCon = new SqlConnection(@"Data Source=(local)sqle2012;initial catalog=LoginDB;integrated security=true;"))
{
string query = "SELECT COUNT(1) FROM People WHERE UserName=@username AND Password=@password";
SqlCommand sqlcmd = new SqlCommand(query, SqlCon);
sqlcmd.Parameters.AddWithValue("@Username", txtUserName.Text.Trim());
sqlcmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());
int count = Convert.ToInt32(sqlcmd.ExecuteScalar());
if (count == 1)
{
Session["Username"] = txtUserName.Text.Trim();
Response.Redirect("Dashboard.aspx");
}
else { lblErrorMessage.Visible = true; }
}
Did you create the Sql Server DataBase LoginDB in Your System ?
yes SQLEXPRESS.LoginDB
do you know the sql server instance name ?
I try to use sspi connection it works good on my machine but get this error on anthers machine in domain
Server Error in '/' Application
application error from being viewed remotely (for security reasons)
I search a lot but get nothing
hope ur help if u don't mind
Check your DB Connection String.
thanks so much for the reply - but DB connection string i guess it right coz it works well on my machine - db server is not my machine just website and iis on my machine -
db is in another server machine right ?
yes sir - we work on domain - theirs machine have db and my machine have website and there others
can you connect server db from your local machine using ssms or visual studio?
This videos s god-like!
Glad you found the video helpful.
Nice
Hello if u could upload a similar video of login according to various roles then it would be a big help
I'll see what I can do!
i am having problem in {int count = Convert.ToInt32(sqlcmd.ExecuteScalar()); } showing No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputPassword to a known managed provider native type. plz help
particular stored procedure should return integer string
done sir
thanks
you are welcome.
You helped me again.
Thank you from my heart
you are welcome.
YOUR NAME IS SHAMZU, DATABASE SERVER DONT LIE
:)
@@CodAffection Happy day to you, I am so lucky to be noticed.
Thank you very much.
I am getting an error message in lblUserDetails
Thanks
TY
Thank you so much.
Watch other tutorials this is out dated and considered bad practice nowadays.