Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want that when user is log-in with the Id and password he should be directed to the page of the user same like facebook. where the user log-in with the user id and password and his profile get opened.
i know about the simple login like
Quote:
SqlDataAdapter myadp = new SqlDataAdapter();
myadp.SelectCommand = new SqlCommand();
myadp.SelectCommand.Connection = con;
con.Open();
myadp.SelectCommand.CommandText = "select * from shantanu where Id=@un and password=@ps";
myadp.SelectCommand.Parameters.AddWithValue("@un", TextBox1.Text);
myadp.SelectCommand.Parameters.AddWithValue("@ps", TextBox2.Text);
SqlDataReader mydr;
mydr = myadp.SelectCommand.ExecuteReader();
Quote:
con.Close();


but i want to display the data associated with it on the next page.
kindly help me.
Posted
Comments
[no name] 8-Feb-14 5:57am    
" data associated with it" means what kind of data..??

So store it - either in Cookies or the Session, and read the values back on the next page. You can then display them perfectly happily.
 
Share this answer
 
Comments
Shantanu sinha 8-Feb-14 8:07am    
any example or link for the same.
This will give you more idea about what OriginalGriff suggested

send-data-from-one-page-to-another-in-c-sharp-asp-net[^]
 
Share this answer
 
Comments
Shantanu sinha 8-Feb-14 8:06am    
any example or link for the same.
After login is successful redirect to Home Page.
Just run another query to get all the Profile details from the table taking the UserName as a condition.
Then show these information on Home Page.

Store any value on Session, which you want to access across all the pages of the Application.
 
Share this answer
 
Comments
Shantanu sinha 8-Feb-14 8:06am    
any example or link for the same.
Okay, refer the below and explore.

1. http://www.aspdotnet-suresh.com/2012/11/aspnet-session-state-example-in-c-vbnet.html
2. http://www.codeproject.com/Questions/159329/how-to-use-sessions-in-asp-net-using-c-sharp-code
3. http://msdn.microsoft.com/en-us/library/ms178581(v=vs.100).aspx
-- You can store mydr in a session like

Session["mydr"]=mydr;

--- By using above this you can access from any page
--- But you have to do unboxing like

mydr=(SqlDataReader) Session["mydr"];
 
Share this answer
 
Comments
Shantanu sinha 8-Feb-14 8:06am    
any example or link for the same.
You can use session to share and save data like that
session[username]= "nitish"
 
Share this answer
 
Comments
Shantanu sinha 8-Feb-14 8:06am    
any example or link for the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900