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
umair mohsin
1.3k
348
55.9k
Login page issue
May 1 2017 6:10 PM
here is my complete code.i am basically making a login page in which a user which is not registered should given a detailed message and those who are registered should send to their profile page i didn't get the idea how to play this game although i am trying alot for this and logically my code is correct but still not working please help me out in it.
string constr = ConfigurationManager.ConnectionStrings["JPConstr"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constr))
{
conn.Open();
SqlCommand cmd = new SqlCommand("select UserId,Password from Sign_Up where UserId=@Id", conn);
cmd.Parameters.AddWithValue("@Id", txtlogin.Text);
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
string User = rdr["UserId"].ToString();
string password = rdr["Password"].ToString();
if (password == txtpassword.Text)
{
Page.Session.Add("user", txtlogin.Text);
Page.Session.Timeout = 20;
Response.Redirect("Profile.aspx?id=success");
}
else if (txtlogin.Text!=User && txtpassword.Text != password)
{
Label3.Text = "Invalid user id or password";
Label3.ForeColor = System.Drawing.Color.Blue;
}
//if (txtlogin.Text!=UserId)
//{
// Label3.Text = "crazy password or user id";
// Label3.ForeColor = System.Drawing.Color.Purple;
//}
else
{
Label3.Text = "Invalid user id or password login with valid account or sign up to register";
Label3.ForeColor = System.Drawing.Color.Red;
}
}
conn.Close();
Reply
Answers (
5
)
How to set ajax result to javascript function parameter ?
What book recommends to buy for 3-Tier Arch.