G
Giggi
Hi!
I need to pass some strings via an HTTP POST from page1 (in my app) to
a page on another server.
I stored my data in a NameValueCollection and then sent it using
WebClient.UploadValues.
Everything works fine but if one of the string contains a european
character (èéòàù...) it's not sent correctly and the char is received
as a '?'
I read at least 20 different posts on similiar problem but didn't find
a solution yet.
any help?
Giggi
This is the code:
Dim uriString As String = "http://aqua.altervista.org/
prova.php"
Dim myWebClient As New Net.WebClient()
Dim myNameValueCollection As New NameValueCollection()
Dim MYTEXT As String = TextBox1.Text
Dim USER As String = TextBox2.Text
Dim responseArray As Byte()
Dim answer As String
' Add necessary parameter/value pairs to the name/value
container.
myNameValueCollection.Add("TEXT", MYTEXT)
myNameValueCollection.Add("USER", USER)
'The Upload(String,NameValueCollection)' method implicitly
sets the HTTP POST as the request method.
myWebClient.Credentials =
Net.CredentialCache.DefaultCredentials
responseArray = myWebClient.UploadValues(uriString,
myNameValueCollection)
'Decode the response.
answer= Encoding.ASCII.GetString(responseArray)
I need to pass some strings via an HTTP POST from page1 (in my app) to
a page on another server.
I stored my data in a NameValueCollection and then sent it using
WebClient.UploadValues.
Everything works fine but if one of the string contains a european
character (èéòàù...) it's not sent correctly and the char is received
as a '?'
I read at least 20 different posts on similiar problem but didn't find
a solution yet.
any help?
Giggi
This is the code:
Dim uriString As String = "http://aqua.altervista.org/
prova.php"
Dim myWebClient As New Net.WebClient()
Dim myNameValueCollection As New NameValueCollection()
Dim MYTEXT As String = TextBox1.Text
Dim USER As String = TextBox2.Text
Dim responseArray As Byte()
Dim answer As String
' Add necessary parameter/value pairs to the name/value
container.
myNameValueCollection.Add("TEXT", MYTEXT)
myNameValueCollection.Add("USER", USER)
'The Upload(String,NameValueCollection)' method implicitly
sets the HTTP POST as the request method.
myWebClient.Credentials =
Net.CredentialCache.DefaultCredentials
responseArray = myWebClient.UploadValues(uriString,
myNameValueCollection)
'Decode the response.
answer= Encoding.ASCII.GetString(responseArray)