Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Request Object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deepak - 12 Feb 2008 09:30 GMT
Hi All,

i m facing a strange situation with request object for asp.net.As per our
project i have to transfer this request from Page1.aspx to Page2.aspx if
contyp = "text/xml".If i remove(ie. comment) the line  
xmlInDoc.Load(Request.InputStream) from PAGE1.ASPX then there is no error in
PAGE2.ASPX and it process it without any error,but if i keep this line
xmlInDoc.Load(Request.InputStream) in PAGE1.ASPX then PAGE2.ASPX give me
error on line  Response.Write(docOUT.xml) saying

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
<MethodResult
Status="2"><Error><ErrorNumber>-1071651496</ErrorNumber><ErrorDescription>An
XML parse error occured.
File Position: 0
Line: 0
Line Position: 0
Reason: XML document must have a top level element.

Source Text: </ErrorDescription><ErrorSource>modXML.LoadXMLDocumentFromURL \\
W6IntInMsgLib</ErrorSource><ErrorLine>0</ErrorLine></Error></MethodResult>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

I can not remove(comment) the line  xmlInDoc.Load(Request.InputStream) in
PAGE1.ASPX as that is needed for some processing in PAGE.ASPX like
Dim xmlearlyStart As XmlNode =
xmlInDoc.SelectSingleNode("SXPTaskUpdateOrAdd/Task/EarlyStart") etc.

Following is my code:

PAGE1.aspx

contyp = Request.ContentType()      ' Read content type of request

If contyp = "text/xml" Then
Dim xmlInDoc As New XmlDocument
Dim xmlInUpdateDoc As New XmlDocument

xmlInDoc.Load(Request.InputStream)
Server.Transfer("w6inboundprocessor.aspx", True)

PAGE2.aspx

Public Class w6inboundprocessor
   Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

   'This call is required by the Web Form Designer.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

   End Sub

   'NOTE: The following placeholder declaration is required by the Web Form
Designer.
   'Do not delete or move it.
   Private designerPlaceholderDeclaration As System.Object

   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
       'CODEGEN: This method call is required by the Web Form Designer
       'Do not modify it using the code editor.
       InitializeComponent()
   End Sub

#End Region

   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
       Dim objProcessor
       Dim docOUT
       Dim blnSuccess

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

       If Err.Number <> 0 Then Call XMLError(Err)

       blnSuccess = False
       While Not blnSuccess
           ' Based on Microsoft's articles there is no need to use the
Server object to create objects.
           ' If we do use the Server objects it costs in performance
           ' and can cause some instability as the bug suggests.
           objProcessor = CreateObject(W6PIncomingProcessor)

           If Err.Number = 0 Then
               blnSuccess = True
           Else
               If Err.Number <> 2147549448 Then
                   Call XMLError(Err)
                   blnSuccess = True
               End If
           End If
       End While
       ' Danny 15/5/05 - Bug #23983
       ' Based on Microsoft's articles there is no need to use the Server
object to create objects.
       ' If we do use the Server objects it costs in performance
       ' and can cause some instability as the bug suggests.
       docOUT = CreateObject("Microsoft.XMLDOM")
       Call docOUT.loadXML(objProcessor.ProcessMessage(binData))
       If Err.Number <> 0 Then Call XMLError(Err)
       Response.ContentType = "text/xml"
       ' Gil (27/2/05): Bug: #23639 - Added unicode support as in the SXP
asp file
       ' Reviewed with Sasha.
       Response.Charset = "utf-8"

       'docOUT.save(Response)
       Response.Write(docOUT.xml)
       Response.End()

   End Sub
   Sub XMLError(ByVal Err)
       Dim strOutput

       strOutput = "<MethodResult><Error>" & _
                   "<ErrorNumber>" & Err.Number & "</ErrorNumber>" & _
                   "<ErrorDescription>" & Err.Description &
"</ErrorDescription>" & _
                   "<ErrorSource>" & Err.Source & "</ErrorSource>" & _
                   "</Error></MethodResult>"

       Call Response.Write(strOutput)
       Response.End()
   End Sub
End Class

Kindly help me. I am waiting for urs replies and thanks in advance from my
side.

-Deepak
+919886735837
kr_deepak123@hotmail.com
kr_deepak123@yahoo.co.in
Kevin Spencer - 12 Feb 2008 11:27 GMT
Why don't you create the XML document from the Request.InputStream in the
second page?

Signature

HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

> Hi All,
>
[quoted text clipped - 142 lines]
> kr_deepak123@hotmail.com
> kr_deepak123@yahoo.co.in
deepak - 12 Feb 2008 15:10 GMT
because the second page needs it in binary format ONLY for processing by that
programid  

 Dim binData = Request.BinaryRead(Request.Totalbytes())

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

kindly let me know how can i proceed plz.

- Deepak

> Why don't you create the XML document from the Request.InputStream in the
> second page?
[quoted text clipped - 145 lines]
> > kr_deepak123@hotmail.com
> > kr_deepak123@yahoo.co.in
bruce barker - 12 Feb 2008 16:23 GMT
the error means the input stream is not valid xml. you should write it to a
file and see what it looks like. you may need to preprocess to convert it to
valid xml before you try to load it into a dom.

-- bruce (sqlwork.com)

> Hi All,
>
[quoted text clipped - 139 lines]
> kr_deepak123@hotmail.com
> kr_deepak123@yahoo.co.in
deepak - 12 Feb 2008 16:46 GMT
No,Actually the code works if i comment line xmlInDoc.Load(Request.InputStream)
in PAGE1.ASPX and limitation of second page is that it has to again use the
request object and process the binary format of it..

Kinldy suggest me...

> the error means the input stream is not valid xml. you should write it to a
> file and see what it looks like. you may need to preprocess to convert it to
[quoted text clipped - 145 lines]
> > kr_deepak123@hotmail.com
> > kr_deepak123@yahoo.co.in

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.