how to debug a server program

Discussion in 'ASP General' started by c676228, Oct 29, 2007.

  1. c676228

    c676228 Guest

    I have a testing client program, the purpose is send a xml file to a server
    program, and the server return another xml message. So I wrote a testing
    server program the simple one and make sure the communication is fine. After
    that I started to program more complicated server program, since there are
    many compliation error. The client program keep displaying:
    The remote server returned an invalid statuscode: #8221;500 Internal Server
    Error

    Is there any way to display a detailed error message about the server
    program in the web browser? So I can quickly debugging it and fix it, not to
    have to waiting for an email from the program?

    Thanks.

    <%
    Set xmlDom=CreateObject("Microsoft.XMLDOM")

    XMLDom.async =False
    xmlDom.load Server.MapPath("0925SelectTest.xml")
    DataToSend = xmlDom.xml

    dim xmlhttp
    set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
    xmlhttp.Open "POST","https://xxxx.com/TestCompleteB2B.asp",false
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.send xmlDom.xml
    if(Err <> 0) then
    Response.Write("An error occured when retrieving data from an external
    source.<br />")
    Response.Write(Err.Description)
    Response.End
    end if
    On error goto 0
    'if request is not Ok then display detailed message about the request
    problem
    if(xmlHttp.status <> 200) then
    Response.Write("The remote server returned an invalid statuscode: #8221;"
    & _
    xmlHttp.status & " " & xmlHttp.statusText)
    Response.End
    end if

    '
    --
    Betty
    c676228, Oct 29, 2007
    #1
    1. Advertising

  2. "c676228" <> wrote in message
    news:...
    > I have a testing client program, the purpose is send a xml file to a

    server
    > program, and the server return another xml message. So I wrote a testing
    > server program the simple one and make sure the communication is fine.

    After
    > that I started to program more complicated server program, since there are
    > many compliation error. The client program keep displaying:
    > The remote server returned an invalid statuscode: #8221;500 Internal

    Server
    > Error
    >
    > Is there any way to display a detailed error message about the server
    > program in the web browser? So I can quickly debugging it and fix it, not

    to
    > have to waiting for an email from the program?
    >
    > Thanks.
    >
    > <%
    > Set xmlDom=CreateObject("Microsoft.XMLDOM")


    Use MSXML2.DOMDocument.3.0,

    >
    > XMLDom.async =False
    > xmlDom.load Server.MapPath("0925SelectTest.xml")


    > DataToSend = xmlDom.xml


    Delete the line above, DataToSend is not needed.

    >
    > dim xmlhttp
    > set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
    > xmlhttp.Open "POST","https://xxxx.com/TestCompleteB2B.asp",false


    > xmlhttp.setRequestHeader "Content-Type",

    "application/x-www-form-urlencoded"

    Your not sending Form data so delete the above request header.

    > xmlhttp.send xmlDom.xml


    The line above should be:-

    xmlhttp.send xmlDom

    XmlHtttp know how to send a DOM and will set the appropriate Content-Type
    "text/xml" for you.


    > if(Err <> 0) then
    > Response.Write("An error occured when retrieving data from an external
    > source.<br />")
    > Response.Write(Err.Description)


    Response.Wrte Err.Description

    Don't use parentheses when call procedures that don't return a value.

    > Response.End


    Don't do Response.Ends unless you really have to.


    > end if
    > On error goto 0
    > 'if request is not Ok then display detailed message about the request
    > problem
    > if(xmlHttp.status <> 200) then
    > Response.Write("The remote server returned an invalid statuscode:

    #8221;"
    > & _
    > xmlHttp.status & " " & xmlHttp.statusText)


    If the server is sending any detail about what went wroing it will be in the
    responseText. In fact it's likely to be a complete HTML page so you might
    consider:-

    Response.Write xmlHttp.responseText


    > Response.End


    Delete the above line.


    > end if
    >




    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Oct 29, 2007
    #2
    1. Advertising

  3. c676228

    c676228 Guest

    Thank you so much Anthony. I will try this.


    "Anthony Jones" wrote:

    > "c676228" <> wrote in message
    > news:...
    > > I have a testing client program, the purpose is send a xml file to a

    > server
    > > program, and the server return another xml message. So I wrote a testing
    > > server program the simple one and make sure the communication is fine.

    > After
    > > that I started to program more complicated server program, since there are
    > > many compliation error. The client program keep displaying:
    > > The remote server returned an invalid statuscode: #8221;500 Internal

    > Server
    > > Error
    > >
    > > Is there any way to display a detailed error message about the server
    > > program in the web browser? So I can quickly debugging it and fix it, not

    > to
    > > have to waiting for an email from the program?
    > >
    > > Thanks.
    > >
    > > <%
    > > Set xmlDom=CreateObject("Microsoft.XMLDOM")

    >
    > Use MSXML2.DOMDocument.3.0,
    >
    > >
    > > XMLDom.async =False
    > > xmlDom.load Server.MapPath("0925SelectTest.xml")

    >
    > > DataToSend = xmlDom.xml

    >
    > Delete the line above, DataToSend is not needed.
    >
    > >
    > > dim xmlhttp
    > > set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
    > > xmlhttp.Open "POST","https://xxxx.com/TestCompleteB2B.asp",false

    >
    > > xmlhttp.setRequestHeader "Content-Type",

    > "application/x-www-form-urlencoded"
    >
    > Your not sending Form data so delete the above request header.
    >
    > > xmlhttp.send xmlDom.xml

    >
    > The line above should be:-
    >
    > xmlhttp.send xmlDom
    >
    > XmlHtttp know how to send a DOM and will set the appropriate Content-Type
    > "text/xml" for you.
    >
    >
    > > if(Err <> 0) then
    > > Response.Write("An error occured when retrieving data from an external
    > > source.<br />")
    > > Response.Write(Err.Description)

    >
    > Response.Wrte Err.Description
    >
    > Don't use parentheses when call procedures that don't return a value.
    >
    > > Response.End

    >
    > Don't do Response.Ends unless you really have to.
    >
    >
    > > end if
    > > On error goto 0
    > > 'if request is not Ok then display detailed message about the request
    > > problem
    > > if(xmlHttp.status <> 200) then
    > > Response.Write("The remote server returned an invalid statuscode:

    > #8221;"
    > > & _
    > > xmlHttp.status & " " & xmlHttp.statusText)

    >
    > If the server is sending any detail about what went wroing it will be in the
    > responseText. In fact it's likely to be a complete HTML page so you might
    > consider:-
    >
    > Response.Write xmlHttp.responseText
    >
    >
    > > Response.End

    >
    > Delete the above line.
    >
    >
    > > end if
    > >

    >
    >
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET
    >
    >
    >
    c676228, Oct 29, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RonL
    Replies:
    0
    Views:
    720
  2. ringos75
    Replies:
    0
    Views:
    930
    ringos75
    Apr 14, 2005
  3. Mike C. Fletcher
    Replies:
    3
    Views:
    966
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 12, 2003
  4. André
    Replies:
    3
    Views:
    1,554
  5. Alan
    Replies:
    4
    Views:
    206
Loading...

Share This Page