Request.InputStream

D

deepak

Hi All,

I have 2 pages Page1.aspx and Page2.aspx. Page1.aspx is main start up page
which wil receieve request from internet.The logic is i have to retrieve some
information(coming as xml via internet), in Page1.aspx and then process it in
Page1.aspx and after processing i have to forward this updated request to
Page2.aspcx

I am doing it in Page.1aspx using HttpRequest(using Request object) and then
moving it into Page2.aspx using Server.Transfer("Page2.aspx", True)

But The second line in Page1.aspx gives me array in binData1 having values
in it and the 4th line does not give me anything(means Nothing)

The Page2.aspx gives me array in binData ONLY if i comment i.e. dont use
Reponse.InputStream in Page1.aspx otherwise if i use it in Page.1aspx then
binData value does not give me anything(i.e.Nothing in Page2.aspx) and the
4th line does not give me anything(means Nothing)

I searched in google and found that the Request InputStream has been
consumed it can not be reset and re-consumed elsewhere. Since I have loaded
the InputStream in to an XML doc already so i cannot using the InputStream to
load another in page 2 and i should avoid consuming it in Page 1 OR find a
way to provide the loaded the XMLDoc to page 2(but there is limitation of
Page2.aspx that it can read the binary values as shown in code so i can not
opt the second way).

Page1.aspx

Dim xmlInDoc As New XmlDocument

xmlInDoc.Load(Request.InputStream)

' some processing.like Dim xmlearlyStart As XmlNode =
xmlInDoc.SelectSingleNode("SXPTaskUpdateOrAdd/Task/EarlyStart") ..etc.
etc..'.....

Server.Transfer("Page2.aspx", True)

Page 2.aspx

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

On Error Resume Next

Const W6PIncomingProcessor = "W6IntUtilsGWWrap.W6IntInMsgProcGW.1"

Dim binData, objProcessor, docOUT, blnSuccess

binData = Request.BinaryRead(Request.TotalBytes())

blnSuccess = False

While Not blnSuccess

objProcessor = CreateObject(W6PIncomingProcessor)

End While

docOUT = CreateObject("Microsoft.XMLDOM")

Call docOUT.loadXML(objProcessor.ProcessMessage(binData))

Response.ContentType = "text/xml"

Response.Charset = "utf-8"

Response.Write(docOUT.xml)

Response.End()



Conclusion

Dim xmlInDoc As New XmlDocument

Dim bin1 = Request.BinaryRead(Request.TotalBytes())

xmlInDoc.Load(Request.InputStream)

Dim bin2 = Request.BinaryRead(Request.TotalBytes())



bin 1 is ful of array and bin2 has nothing...Is there any oother way to
write this below sentence ...

xmlInDoc.Load(Request.InputStream) as this is the only one which is creating
problem... ?

Thanks in Advance,

Deepak
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top