I am getting wrong .Plz anyone help
** System.NullReferenceException: Object reference not set to an instance of an object.
//Line 35: SqlCommand cmd = new SqlCommand("Select * UserInfm where UserName = '" + Request.Cookies["Login"]["UserName"].ToString() + "' ", con);
if(!IsPostBack)
{
if( Session["Login"] == null && Request.Cookies["Login"]==null)
{
Response.Redirect("Login.aspx");
}
else
{
string cs = ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand("Select * UserInfm where UserName = '" + Request.Cookies["Login"]["UserName"].ToString() + "' ", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
LabelUN.Text = rdr["UserName"].ToString();
}
}
con.Close();
}
Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-cache,no-store,max-age=0,must-revalidate");
Response.AddHeader("Pragma", "no-cache");
}
}
}