TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
271
36.6k
Check username and password is incorrect in asp.net
Jul 30 2020 1:19 AM
when user login if username is incorrect then it will show error if password is incorrect its shows error...in my code its is username or password is incorrect then it will show error.. i want for both condition.this all done by Entity Framework
protected void Button1_Click(object sender, EventArgs e)
{
string UserName = TxtUserName.Text;
WallpaperEntities4 db = new WallpaperEntities4();
string ID = Request.QueryString["Id"];
string query = (from c in db.Users
where c.UserName == TxtUserName.Text && c.Password == TxtPassword.Text
select c.UserName).FirstOrDefault();
if (query != null)
{
Session["UserName"] = UserName;
Response.Redirect("/Walpaper.aspx?username="+UserName);
}
else
LblMesge.Text = "Invalid User or password";
}
Reply
Answers (
6
)
how to bind data fileupload control use database in mvc 5 with ajax(co
TryGetValue returns Null even though key exists