Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 22, 2010 @ 15:30
    Jeroen Breuer
    0

    Login without saving login data.

    Hello,

    I've created my own login page with a loginname and password textbox. After the login button is pressed I do the following:

       /// <summary>
            /// Login the member.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void LnkBtnLogin_Click(object sender, EventArgs e)
            {
                Member member = Member.GetMemberFromLoginNameAndPassword(TxtUserName.Text, TxtPassword.Text);
    
                if (member != null)
                {
                    //If the member is not null it is found and can log in.
                    Member.AddMemberToCache(member);
    
                    //Redirect to the welkom page if after the member logged in.
                    Response.Redirect(umbraco.library.NiceUrl(Configuration.LoginWelkomPageId));
                }
            }

    This code works, but the member stays logged in even after leaving closing the browser. This should only be done if the member has a checkbox checked. Otherwise the member needs log in again after closing the browser. Does someboy know how I need to change my code for this?

  • Richard Soeteman 4054 posts 12927 karma points MVP 3x
    Feb 22, 2010 @ 15:51
    Richard Soeteman
    1

    Hi Jeroen,

    I'll suggest you use the normal ASP.NET Login control. I haven't experienced these issues with the normal asp.net controls.

    Cheers,

    Richard

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 22, 2010 @ 15:59
    Jeroen Breuer
    0

    Thanks Richard! I'll try those. Do I need to make any changes for this or is just placing the login control enough?

  • Richard Soeteman 4054 posts 12927 karma points MVP 3x
    Feb 22, 2010 @ 17:28
    Richard Soeteman
    0

    Just add the login control and you are good to go,.

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies