Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:12:58+00:00 2026-05-15T17:12:58+00:00

I had login Page and it worked well but remember me check box didn’t

  • 0

I had login Page and it worked well but remember me check box didn’t work well and I couldn’t know where the error please anyone help me this is my code

public partial class _Default : System.Web.UI.Page
{
public TextBox Usertxt,Passwordtxt;

protected void Page_Load(object sender, EventArgs e)
{
    Usertxt = (TextBox)Login1.FindControl("UserName");
    Passwordtxt = (TextBox)Login1.FindControl("Password");
    if (!IsPostBack)
    {
        if (Request.Cookies["Mycookie"] != null)
        {
            HttpCookie Cookie = Request.Cookies.Get("Mycookie");
            Usertxt.Text=Cookie.Values["UserName"];
            Passwordtxt.Text=Cookie.Values["Password"];


        }
    }

}
protected void LoginButton_Click(object sender, EventArgs e)
{
    Usertxt = (TextBox)Login1.FindControl("UserName");
    Passwordtxt = (TextBox)Login1.FindControl("Password");
    Literal LBL;

    LBL = (Literal)Login1.FindControl("FailureText");

    if (FormsAuthentication.Authenticate(Usertxt.Text, Passwordtxt.Text))
    {
        Response.Redirect("");

    }
    else
    {
        Login1.FindControl("FailureText");
        LBL.Text = "error ocurred";
    }


}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:12:59+00:00Added an answer on May 15, 2026 at 5:12 pm

    Thank you more I got the answer and this the right code

    public partial class _Default : System.Web.UI.Page
    {
    public TextBox Usertxt, Passwordtxt;
    public Literal LBL;
    public CheckBox CHB;

    protected void Page_Load(object sender, EventArgs e)
    {
        Usertxt = (TextBox)Login1.FindControl("UserName");
        Passwordtxt = (TextBox)Login1.FindControl("Password");
        if (!IsPostBack)
        {
            if (Request.Cookies["MyCookie"] != null)
            {
                HttpCookie Cookie = Request.Cookies.Get("MyCookie");
                Usertxt.Text = Cookie.Values["UserName"];
                Passwordtxt.Text = Cookie.Values["Password"];
            }
        }
    
    }
    protected void LoginButton_Click(object sender, EventArgs e)
    {
    
    
        Usertxt = (TextBox)Login1.FindControl("UserName");
        Passwordtxt = (TextBox)Login1.FindControl("Password");
        CHB = (CheckBox)Login1.FindControl("RememberMe");
        LBL = (Literal)Login1.FindControl("FailureText");
    
        HttpCookie MyCookie = new HttpCookie("MyCookie");
        bool IsRememberme = CHB.Checked;
        if (IsRememberme)
        {
            MyCookie.Values.Add("UserName", Usertxt.Text);
            MyCookie.Values.Add("Password", Passwordtxt.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);
    
    
    
    
        if (FormsAuthentication.Authenticate(Usertxt.Text, Passwordtxt.Text))
        {
    
            Response.Redirect("");
    
        }
        else
        {
            Login1.FindControl("FailureText");
            LBL.Text = "error ocurred";
        }
    
    
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a login page. once user successfuly logged in, they can view and
I have implemented antiforgery token on my login page. Now I had one user
Had to download Command Line Tools from Apple to get make to work, but
I need some help. I had created login page from that page user with
I've had a login I have used so far to login while I was
I am new to C# Programming. I had drag a login control into my
I had the sample facebook login implementation, and just realized that it stopped working:
I am trying to get my session login script working and I had the
Hey This is my login script, using PHP5 and MYSQLi, I just had help
From the documentation here http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.layouttemplate.aspx i had customized the user interface of login control

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.