I have a problem in userlogin in asp.net

Posted by Nuwan under ASP.NET on 11/22/2011 | Points: 10 | Views : 3336 | Status : [Member] | Replies : 7
HI,
I create a asp.net+sql web application, I want to make a User Login page for it. I want to that application some user login a system that user image show in main asp application.how i do that.
Please Help me...

Thank You!!!

Rathnayake


Responses

Posted by: Anweshabhowmick on: 11/22/2011 [Member] Starter | Points: 25

Up
0
Down
1. First Design a Login page.
2. Then In welcome Page put a Image.
3.Create Table which contain email,pwd and image field.


using System.Data.SqlClient;

SqlConnection con = new SqlConnection("");//place ur connection string
con.Open();
SqlCommand cmd = new SqlCommand("select * from User where email='"+TextBox1.Text+"' and pwd= '"+TextBox2.Text+"'",con);
SqlDataReader dr = new SqlDataReader(cmd);
dr.Read();
if(dr.HasRows)
{
session["image"]= dr["image"].ToString();
Response.Redirect("Welcome.aspx");
}
else
{
Response.Redirect("Login.aspx");
}

con.close();


in welcome page

Image1.ImageUrl=session["image"].Tostring();

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

Posted by: Nuwan on: 11/22/2011 [Member] Starter | Points: 25

Up
0
Down
HI Anweshabhowmick,

If you can please give me some application sample.

Rathnayake

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

Posted by: Biswarup90 on: 11/22/2011 [Member] Starter | Points: 25

Up
0
Down
Anwesha bhowmick is right for the code.

Biswarup Ghosh

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

Posted by: Anweshabhowmick on: 11/22/2011 [Member] Starter | Points: 25

Up
0
Down
Dear Rathnayake ,

First Create an application and design the page then copy paste this code...it will certainy work...First try yourself if u cant then i will send you the Full application.

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

Posted by: Nuwan on: 11/22/2011 [Member] Starter | Points: 25

Up
0
Down
I copy paste that code.but welcome page not view image.Please help me.

Rathnayake

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

Posted by: Nuwan on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
Dear Anweshabhowmick
Please give me a source code sample with database.Because I copy past that code sample. But welcome page image is not visible.
Thank You...

Rathnayake

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

Posted by: Biswarup90 on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
plz paste your home page screen shot...

Biswarup Ghosh

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

Login to post response