Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Remember me Next time

Remember me Next time

Scheduled Pinned Locked Moved ASP.NET
htmldesignhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aransiola
    wrote on last edited by
    #1

    This checkbox on my login control has been working but now, the if i check teh Remember Me check box, teh login control does not remember my last login user name. see my code below I am using Internet explorer 6. Mozilla Firefox display the first 5 characters of my userID Imports FriendsTier Partial Class Login Inherits System.Web.UI.Page Dim oTier As FriendsTier = New FriendsTier Dim strUserID As String Dim strPassword As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'If IsPostBack Then 'on for the first time If Request.Cookies("loginuserid") IsNot Nothing Then Dim strUserID As String = Request.Cookies("loginuserid")("user") If strUserID IsNot Nothing Then myLogin.UserName = strUserID.ToString End If End If End Sub Protected Sub myLogin_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles myLogin.Authenticate strUserID = myLogin.UserName.Trim strPassword = myLogin.Password.Trim If Session("loginuserid") IsNot Nothing Then Session.Remove("loginuserid") End If If oTier.ValidMember(strUserID, strPassword) = True Then 'create the session vars Session("loginuserid") = strUserID 'grants the access, goto Destination url page e.Authenticated = True Else 'confirm that you are out e.Authenticated = False End If End Sub Protected Sub myLogin_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles myLogin.LoggedIn 'This event is fired when the Login button is pressed Dim chkRemember As CheckBox 'Since At the Conversion to html, the checkbox is named as login.ID along with the "$RememberMe". 'Since no such control (RememberMe) exist, you are getting error. 'always check whether the control exists ' If (Not Me.FindControl(myLogin.ID & "$RememberMe") Is Nothing) Then chkRemember = CType(Me.FindControl(myLogin.ID & "$RememberMe"), CheckBox) Else chkRemember = New CheckBox() End If If chkRemember.Checked = True Then 'cookies are sent to the user's pc using httpresponse Dim oCookie As HttpCookie = New HttpCookie("loginuserid") 'remove previous cookie

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups