'How do I check the session in ASP.NET?

I am a newbie at asp.net, and I don't know why my session won't work out even if I type the same thing with it.

It always go to the else clause.

protected void Page_Load(object sender, EventArgs e)
{
    Session["ar"] = "1as2c";
    Label1.Text = Session["ar"].ToString();
}

protected void Button1_Click(object sender, EventArgs e)
{
    if (TextBox1.Text == Session["ar"] as string)
    {       
        label.text = "success";
    }
    else
    {
        label.Text = " went wrong";
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source