By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

problem with the encodŁng of the posted data

P: n/a
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.FormsCookieNam e)
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"

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


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

"buran" <bu***@buran.com> ”ŌŌ¬›…Ő/”ŌŌ¬›…ŐŃ ◊ őŌ◊Ō”‘—» ”ŐŇń’ņ›ŇŇ:
news:OY**************@TK2MSFTNGP09.phx.gbl...
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.FormsCookieNam e)
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"

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.