problem with the encodüng of the posted data

B

buran

Hi,

I am posting some data in Turkish with the HttpWebRequest and saving the
response stream in the database. The characters in the page are shown
properly but the Turkish characters in the posted data are not shown
properly. I couldn't find any solution. Please help me...
Code is given below:

Sub UploadDoc()
Dim myWebReq As HttpWebRequest
Dim myWebResp As HttpWebResponse
Dim authCookie As HttpCookie
Dim cc As New CookieContainer()
Dim encoding As New System.Text.UnicodeEncoding()
Dim postData As String
Dim data() As Byte
Dim s As Stream
Dim sr As StreamReader
myWebReq =
WebRequest.Create("http://burak/database/medicalDocs/F324.aspx")
authCookie = Request.Cookies(FormsAuthentication.FormsCookieName)
myWebReq.CookieContainer = cc
myWebReq.CookieContainer.Add(New System.Net.Cookie(authCookie.Name,
authCookie.Value, authCookie.Path, "burak"))
postData += "fd=" + txtFlightDate.Text
postData += "&"
postData += "fn=" + txtFlightNo.Text
postData += "&"
postData += "notes=" + txtNotes.Text
data = encoding.GetBytes(postData)
myWebReq.Method = "POST"
myWebReq.ContentType = "application/x-www-form-urlencoded"
myWebReq.ContentLength = data.Length
s = myWebReq.GetRequestStream()
s.Write(data, 0, data.Length)
myWebResp = myWebReq.GetResponse
s.Close()
sr = New StreamReader(myWebResp.GetResponseStream, encoding.Unicode)
Dim strHTML As String
strHTML = sr.ReadToEnd()
Dim docBuffer() As Byte
docBuffer = encoding.GetBytes(strHTML)
'Upload into the database..

strSql = "spUploadDocIntoDatabase"
 
K

Kondratyev Denis

I have same problem with cyrilic characters (I got spaces). After I deleted
codePage="1251" from aspx file all work correct.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top