Session value ,Error ,C#

Posted by Raja_89 under ASP.NET on 4/5/2013 | Points: 10 | Views : 847 | Status : [Member] | Replies : 2
Hai Techie

When user gives his username and password ,he will redirect to his personal page with his username

i got this from session
It shows an error

Object reference not set to an instance of an object.

Code:
Login Page

Session ["firstname"] = Convert.ToString(sda.GetString(sda.GetOrdinal("Firstname")));

Client:
usernamelbl.Text = Session["firstname"].ToString();

Kindly guide me


Regards




Responses

Posted by: Satyapriyanayak on: 4/5/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Session["UserName"] = TextBox_user_name.Text;

usernamelbl.Text = Session["UserName"];



If this post helps you mark it as answer
Thanks

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

Posted by: Ankitsrist on: 4/5/2013 [Member] Starter | Points: 25

Up
0
Down
instead of this
Session ["firstname"] = Convert.ToString(sda.GetString(sda.GetOrdinal("Firstname"))); 

//take value in session variable from textbox which u want to display in nxt page
simply write Session ["firstname"] = textbox1.text;

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

Login to post response