tags:

views:

41

answers:

2

I had Login form ,and I added check box for remember me ,I did my code well but when I check rememeber me check box it rememeber only user name only.so please any one help me.

protected void CBRemeber_CheckedChanged(object sender, EventArgs e)
    {
        HttpCookie MyCookie = new HttpCookie("MyCookie");
        bool IsRememberme = CBRemeber.Checked;
        if (IsRememberme)
        {
            MyCookie.Values.Add("UserName", TxtUser.Text);
            MyCookie.Values.Add("Password", TXTPassword.Text);
            MyCookie.Expires = DateTime.Now.AddDays(15);

        }
        else
        {
            MyCookie.Values.Add("UserName", string.Empty);
            MyCookie.Values.Add("Password", string.Empty);
            MyCookie.Expires = DateTime.Now.AddDays(5);

        }
        Response.Cookies.Add(MyCookie);
    }
A: 

Do you encrypt you password any where?

Sudantha
I add property to txtpassword textmode=Password only
KareemSaad
A: 

You can't set the value of an ASP.NET Textbox control with TextMode="Password". Instead you can use a plain HTML element,

<input id="tbPassword" type="password" value="Hello World!" />

which wil let you set the value. Server you can retrieve the value on postbacks using Request.Form.

Also note if you're using the built-in ASP.NET Login control, the "Remember Me" checkbox behaves a little different than what you might expect.

Jakob Gade