diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 832d3c44e..17e401ead 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -43,7 +43,10 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ActualizaPrePoliza(context) Case "getpersonal" getpersonal(context) - + Case "GettingCURP" + context.Response.Write(GettingCURP(context.Request("Curp").ToString(), context.Request("year").ToString().ToEntero())) + Case "ValidaCURP" + context.Response.Write(ValidaCURP(context.Request("Curp").ToString())) End Select Catch ex As Exception ex.GuardaLog(ex.Message) @@ -181,6 +184,225 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End Sub #End Region + + Private Shared Function sendURL(ByVal URL As String, Optional Methodo As String = "POST", Optional Cookie As String = "", Optional maxTimeMilliseconds As Integer = 120000) As String + Dim resultado As String = "" + + Try + Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest) + request.Timeout = maxTimeMilliseconds + request.Method = Methodo + request.ContentType = "text/html; charset=utf-8" '"text/xml; charset=utf-8" + + If Not String.IsNullOrEmpty(Cookie) Then + request.Headers.Add("Cookie", Cookie) + End If + + 'Using stream As IO.Stream = request.GetRequestStream() + + ' Using stmw As IO.StreamWriter = New IO.StreamWriter(stream) + ' stmw.Write("") + ' End Using + 'End Using + + Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse) + Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream()) + resultado = sr.ReadToEnd() + sr.Close() + Catch ex As Exception + ex.ToString().GuardaLog() + 'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}") + End Try + + Return resultado + End Function + + Public Shared Function GettingCURP(ByVal Curp As String, year As Integer) As String + Dim abc As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} + Dim numeric01 As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} + Dim rule1 As String() = If(year < 2000, numeric01, abc) + Dim curpresult As String = "" + Dim i As Integer = 0 + While curpresult.Length = 0 AndAlso i < rule1.Length + Dim z As Integer = 0 + While curpresult.Length = 0 AndAlso z < numeric01.Length + curpresult = String.Format("{0}{1}{2}", Curp, rule1(i), numeric01(z)) + Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", curpresult), "GET") + + Dim trlines As New List(Of String) + Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String) + + Dim indexttr As Integer = 0 + Dim indexttrB As Integer = 0 + Dim indexttd As Integer = 0 + Dim indextdiv As Integer = 0 + Dim indexinittext As Integer = 0 + While Not IsNothing(respuesta) AndAlso respuesta.Length > 0 + indexttr = respuesta.IndexOf("
- |
+ |
-
- |
-
- |
-
- |
-
- |
+
+ |
+
+ |
+
+ |
+
+ |
-
- |
+
+ |
-
- |
+
+ |
-
- |
+
+ |
-
- |
+
+ |
-
- |
+
+ |
- Comandos |
- |
+ Comandos | +
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1760,9 +1775,9 @@
|