Session value ,Error ,C#

Posted by Raja_89 under ASP.NET on 4/5/2013 | Points: 10 | Views : 1800 | Status : [Member] | Replies : 1
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: 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