Advertisement
ClaudioSLice

Untitled

Nov 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using capaLogicaNegocio;
  8. using System.IO;
  9. using System.Xml.Serialization;
  10. using System.Web.Security;
  11.  
  12. namespace capaPresentacion
  13. {
  14. public partial class webLogin : System.Web.UI.Page
  15. {
  16. CL_Usuario usuario = new CL_Usuario();
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19.  
  20. }
  21.  
  22. protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
  23. {
  24. servicioAutenticacion.OperacionesClient servicio = new servicioAutenticacion.OperacionesClient();
  25.  
  26. XmlSerializer serializador = new XmlSerializer(typeof(CL_Usuario));
  27.  
  28. StringReader lector = new StringReader(servicio.validar(Login.UserName, Login.Password));
  29.  
  30. CL_Usuario usu = (CL_Usuario)serializador.Deserialize(lector);
  31.  
  32. if (usu != null)
  33. {
  34. Login.UserName = usu.Nombre + " " + usu.Apellido;
  35. e.Authenticated = true;
  36.  
  37. Session["Usuario Valido"] = usu;
  38.  
  39. //el redirect no funciona si no agrega la etiqueta <authorization> y <authentication> en el Web.Config
  40. FormsAuthentication.RedirectFromLoginPage(Login.UserName, false);
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement