
amreo (Normal User)
Pro
    
Messaggi: 93
Iscritto: 18/03/2013
|
Ho un GROSSO problema.
Ho creato un codice in vb.net che data una stringa contenente un protocollo HTTP
es:
Codice sorgente - presumibilmente C# / VB.NET |
GET /wiki.com/Pagina_principale HTTP/1.1
Connection: Keep-Alive
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko)
Accept: text/html, image/jpeg, image/png, text/*, image/*, */*
Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Language: en
Host: it.wikipedia.org
|
La legge è mi imposta le proprietà di un WebRequest.
per farlo ho creato un codice che divide la stringa in più parti(dividendo le sottostringhe da VbCrLf.
poi ho forato con for each: ogni linea viene aggiunto al WebHeaderCollection()
Codice sorgente - presumibilmente VB.NET |
Dim _hes As New WebHeaderCollection() 'aggiunge tutte le linee alla collezione For Each he As String In header 'verifica che la linea sia corretta Try 'aggiunge l'header _hes.Add(he.Remove(he.IndexOf(":")), he.Substring(he.IndexOf(":") + 1) Catch ex As Exception '[...] End Try Next
|
però mi da errore in quasi tutte le linee perchè ci sono caratteri es ;
|