diff --git a/LogIn.aspx.vb b/LogIn.aspx.vb index 104e4dd54..373b95ad4 100644 --- a/LogIn.aspx.vb +++ b/LogIn.aspx.vb @@ -29,16 +29,14 @@ Partial Class LogIn #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load - '"187.158.96.163" es la de mi casa - 'If (Context.Session("UsuarioSIG") IsNot Nothing) OrElse Not User.Identity.IsAuthenticated Then - 'Request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJOb21icmUiOiJhZG1pbiIsIkN2ZVVzdWFyaW8iOiIyMDA5IiwiQ3ZlRW1wcmVzYSI6IjIiLCJDdmVQZXJmaWwiOiIyIiwiTWFpbCI6ImFkbWluQGFkbWluLmNvbSIsImV4cCI6MTU5NDY3MzQ2NCwiaXNzIjoiVGVzdC5jb20iLCJhdWQiOiJUZXN0LmNvbSJ9.vmPRxGfxzR10Rf-4Luk2Ej0SVs7w2XGDGJBCyx5VSQI") - 'Response.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJOb21icmUiOiJhZG1pbiIsIkN2ZVVzdWFyaW8iOiIyMDA5IiwiQ3ZlRW1wcmVzYSI6IjIiLCJDdmVQZXJmaWwiOiIyIiwiTWFpbCI6ImFkbWluQGFkbWluLmNvbSIsImV4cCI6MTU5NDY3MzQ2NCwiaXNzIjoiVGVzdC5jb20iLCJhdWQiOiJUZXN0LmNvbSJ9.vmPRxGfxzR10Rf-4Luk2Ej0SVs7w2XGDGJBCyx5VSQI") - 'Response.End() - 'End If + Dim iplist As String() = New String() {"", ""} If HttpContext.Current.Request.ServerVariables("REMOTE_ADDR").ToString().Contiene(iplist) Then Response.Redirect("http://www.adsistemas.mx/login.aspx") 'si alguien lo ve es correcto la pagina vieja de adsistemas End If + + + 'leer un txt para validar una ip Dim token As String = GetTokenAngular() If (token.Length > 0) Then If Not IsNothing(Request("port")) Then @@ -92,7 +90,22 @@ Partial Class LogIn PnlLoginB.CssClass = "logincint login-form " PnlContraB.CssClass = "logincint login-form " lnkFavicon.Href = "/Imagenes/favicongps.ico" - Else + End If + + Dim clientIp As String = (If(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), + Request.ServerVariables("REMOTE_ADDR"))).Split(","c)(0).Trim() + ' Ruta del archivo con las IP bloqueadas + Dim path As String = Server.MapPath("/Utilerias/IPBloqueadas.txt") + + If System.IO.File.Exists(path) Then + ' Leer el contenido del archivo y separarlo por ";" + Dim contenido As String = System.IO.File.ReadAllText(path) + Dim ipBloqueadas As String() = contenido.Split(";"c) + ' Verificar si la IP está en la lista + If ipBloqueadas.Any(Function(ip) ip.Trim() = clientIp) Then + Alert(" this site can't be reached

refused to connect.

ERR_CONNECTION_REFUSED

", TipoMensaje.MsgError) + BtnLogIn.Visible = False + End If End If HdfImagenes.Value = strimg.ToString()