Hola
Ya hice la aplicacion en vb.net 2010, solo que no me funciona cuando los equipos tiene instalada la version 9 o 11 de internet explorer
Les comparto mi codigo
alguna ayuda
Ya hice la aplicacion en vb.net 2010, solo que no me funciona cuando los equipos tiene instalada la version 9 o 11 de internet explorer
Les comparto mi codigo
Código (vbnet) [Seleccionar]
Dim htmlDocument As HtmlDocument = Me.WebBrowser1.Document
Dim prueba As String = htmlDocument.GetType.ToString
Dim htmlElementCollection As HtmlElementCollection = htmlDocument.Images
Dim ImagesFound As Integer
For Each htmlElement As HtmlElement In htmlElementCollection
Dim imgUrl As String = htmlElement.GetAttribute("id")
If imgUrl = "BtnDescarga" Then
imgUrl = Replace(htmlElement.OuterHtml, Chr(34), "")
ImagesFound = InStr(imgUrl, "','Recuperacion')")
imgUrl = imgUrl.Substring(103, ImagesFound - 104)
imgUrl = "https://portalcfdi.facturaelectronica.sat.gob.mx/" & imgUrl
ListBox1.Items.Add(imgUrl)
End If
Next
Dim URI, archivo As String
Dim wc As New WebClient
wc.Headers.Add(HttpRequestHeader.Cookie, GetGlobalCookies(WebBrowser1.Document.Url.ToString))
For i = 0 To ListBox1.Items.Count - 1
URI = ListBox1.Items.Item(i).ToString.Trim
wc.DownloadFile(URI, ruta a guardar)
next
<DllImport("wininet.dll", CharSet:=CharSet.Auto, SetLastError:=True, PreserveSig:=True)> _
Private Shared Function InternetGetCookieEx(ByVal pchURL As String, ByVal pchCookieName _
As String, ByVal pchCookieData As StringBuilder, _
ByRef pcchCookieData As UInteger, ByVal dwFlags As Integer, _
ByVal lpReserved As IntPtr) As Boolean
End Function
Const INTERNET_COOKIE_HTTPONLY As Integer = &H2000
Public Shared Function GetGlobalCookies(ByVal uri As String) As String
Dim datasize As UInteger = CInt(strCache)
'Dim datasize As UInteger = 8192
Dim cookieData As New StringBuilder(CInt(datasize))
If InternetGetCookieEx(uri, Nothing, cookieData, datasize, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero) AndAlso cookieData.Length > 0 Then
'Return cookieData.ToString().Replace(";"c, ","c)
Return cookieData.ToString()
Else
Return Nothing
End If
End Function
alguna ayuda