0

I am using asp.net C#; I create a session this type.

How get data from this session ?

 using (envanterEntities envanter = new envanterEntities())
        {

            kullanicilar kull = new kullanicilar();
            if (envanter.kullanicilar.Any(n => n.kullaniciAdi == txtUser.Text && n.parola == txtPass.Text))
            {
                Session["parola"] = envanter.kullanicilar.First(n=>n.kullaniciAdi==txtUser.Text && n.parola==txtPass.Text);// my session
                Response.Redirect("MainPage.aspx?userName=" + txtUser.Text);
                HttpCookie cookie1 = new HttpCookie("bilgi");
                cookie1.Name = "bilgi";
                cookie1.Expires = DateTime.Now.AddDays(30);
                cookie1.Value = DateTime.Now.ToString();
            }
1
  • Note that you have a problem on the page. The code after Response.Redirect will never be called. Nor would it have any meaning otherwise either, since you don't add the cookie to anywhere Commented May 21, 2015 at 9:49

2 Answers 2

2
var yoursession=(TheTypeThatFirstReturns)Session["parola"];
Sign up to request clarification or add additional context in comments.

Comments

0
kullanicilar kull1 = (kullanicilar)Session["parola"];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.