Tuesday, October 11, 2011

Using Request.InputStream multiple times in .Net program

I wanted to use the Request.Inputstream for multiple things in a program, but when I went to use it the second time, nothing was returned. I found you need to set the position parm to zero, before using the Request.InputStream on subsequent calls.

Example:

dim inXML as string
inXML=Request.InputStream

dim inXML2 as string
Request.Inputstream.Position=0
inXML2 =Request.InputStream

The second variable will contain the same thing as the first.

No comments:

Post a Comment