Guest User

Untitled

a guest
Jun 28th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. Conexion usuario
  2.  
  3. Dim data As DataSet = CType(Application("datos"), DataSet)
  4.  
  5. For Each inst As DataRow In data.Tables("Customers").Rows
  6. If Login1.UserName = inst.Item("ContactName") AndAlso Login1.Password = inst.Item("ContactName") Then
  7. Dim cookie As HttpCookie = Request.Cookies(Login1.UserName)
  8.  
  9. ' Si no existe la cookie de ultima sesión, la crea en el momento
  10. ' Se guarda "ultimaconexion" en una session, ya que sino se sobreescribe el valor de la cookie, mostranso siempre la fecha d ela conexión actual
  11. If cookie Is Nothing Then
  12. cookie = New HttpCookie(Login1.UserName)
  13. End If
  14.  
  15. Session("Ultimaconexion") = cookie("Ultimaconexion")
  16. cookie("Ultimaconexion") = Now
  17. cookie.Expires = Now.AddMonths(1)
  18. Response.Cookies.Add(cookie)
  19.  
  20. ' Guardar el usuario actual en la sesión
  21. Session("user") = Login1.UserName
  22.  
  23. ' Indicamos que ha conectado correctamente
  24. e.Authenticated = True
  25. End If
  26. Next
  27.  
  28. Pagina maestra
  29. If Session("Ultimaconexion") Is Nothing Then
  30. LblNombre.Text = Now
  31. Else
  32. LblVisita.Text = Session("Ultimaconexion")
  33. End If
  34.  
  35. LblNombre.Text = Session("Ultimaconexion")
  36. LblVisita.Text = Session("user")
Add Comment
Please, Sign In to add comment