Retrieve posted information

D

Dan Avni

I am trying to get information posted to my web page through the
request.form but the problem is that the machine that is posting me
the information does not include the content-type header in the
request to my IIS machine. because of that (i think) i get nothing in
the request.post object

is there any way around this? can i get to see the posted information
maybe through some server variable or something?

i am using IIS 5, ASP.NET on Framework 1.1

Thanks
 
M

[MSFT]

Hi Dan,

What is the Data type you need to post to ASP.NET web server? I think you
may consider Request.InputStream to get the data in binary mode, and then
convert it to string, or else:

Dim str As Stream, strmContents As String
Dim counter, strLen, strRead As Integer

' Create a Stream object.
str = Request.InputStream
' Find number of bytes in stream.
strLen = CInt(str.Length)
' Create a byte array.
Dim strArr(strLen) As Byte
' Read stream into byte array.
strRead = str.Read(strArr,0,strLen)

' Convert byte array to a text string.
For counter = 0 To strLen-1
strmContents = strmContents & strArr(counter).ToString()
Next counter

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
D

Dan Avni

Luke Hi,

thanks for the reply. this is exactly what i needed
the only diffrence is that i decoded the string using UTF8 decoder which is
faster that concating characters
note that i am directly loading the decoded string into XMLDOM which is an
XML object i created

' Create a Stream object.
Dim Str As System.IO.Stream = Request.InputStream
' Find number of bytes in stream.
Dim strLen As Long = CInt(Str.Length)
' Create a byte array.
Dim strArr(strLen) As Byte
' Read stream into byte array.
Dim strRead As Integer = Str.Read(strArr, 0, strLen)
' Convert byte array to a text string.
With New System.Text.UTF8Encoding
Dim Chars(.GetCharCount(strArr, 0, strArr.Length)) As Char
.GetChars(strArr, 0, strArr.Length, Chars, 0)
XMLDOM.LoadXml(New String(Chars))
End With
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top