473,396 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

decoding the posted data with HttpWebRequest

Dear ASP.NET Programmers,

I am saving the contents of a file to the database using HttpWebRequest and
HttpWebResponse classes. I am also posting some data to the requested page.
What I cannot manage to do is to decode and read the data on the requested
page. Below is the code of the request and then the code in the requested
page given. How can I decode the posted data? Thanks in advance.

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.ASCIIEncoding()
Dim postData As String
Dim data() As Byte
Dim s1, s2 As Stream

postData += "fd=" + txtFlightDate.Text
postData += "&"
postData += "fn=" + txtFlightNo.Text
postData += "&"
postData += "fdest=" + txtFlightDest.Text
postData += "&"
postData += "esc=" + rblMedicalEscort.SelectedItem.Value
postData += "&"
postData += "str=" + rblStretcher.SelectedItem.Value
postData += "&"
postData += "notes=" + txtNotes.Text
data = encoding.GetBytes(postData)
myWebReq =
WebRequest.Create("http://burak/database/medicalDocs/F325.aspx")
myWebReq.Method = "POST"
myWebReq.ContentType = "application/x-www-form-urlencoded"
myWebReq.ContentLength = data.Length
s1 = myWebReq.GetRequestStream()
s1.Write(data, 0, data.Length)
s1.Close()
authCookie = Request.Cookies(FormsAuthentication.FormsCookieNam e)
myWebReq.CookieContainer = cc
myWebReq.CookieContainer.Add(New System.Net.Cookie(authCookie.Name,
authCookie.Value,
authCookie.Path, "burak"))
myWebResp = myWebReq.GetResponse
Dim docSize As Integer = myWebResp.ContentLength
Dim docBuffer(docSize) As Byte
s2 = myWebResp.GetResponseStream
s2.Read(docBuffer, 0, docSize)
Nov 20 '05 #1
0 1229

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: steve | last post by:
Hi, I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
4
by: supster | last post by:
Hello, I am trying to use HttpWebRequest to simulate sending some POST data from a form to a PHP script. I have accomplished this using: HttpWebRequest req = (HttpWebRequest)...
0
by: buran | last post by:
Dear ASP.NET Programmers, I am saving the contents of a file to the database using HttpWebRequest and HttpWebResponse classes. I am also posting some data to the requested page. What I cannot...
1
by: buran | last post by:
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...
4
by: Christina N | last post by:
What is the easiest way to make an ASP.Net application send data to another web-app? For instance I would like APP3 to log user stats from APP1 and APP2. The applications are located on different...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
0
by: BlipBlip | last post by:
Hi All, I was not sure which forum to post the message to since the problem related to ASP/AJAX, but decided to post it here. I have a simple routine which utilizes an Ajax to query database for...
3
by: mviuk | last post by:
Hi, I'm looking for a system which detaches the decoding process from the encoding process. That is, I would like a system for encoding data, but even if both the encoded data and the encoding...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.