Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Error Sending XML Response in ASP.NET

Avatar of CRCInfosys
CRCInfosys asked on
Programming Languages-Other.NET ProgrammingASP.NET
5 Comments1 Solution840 ViewsLast Modified:
I have a listener webpage designed in ASP.Net that receives XML documents then updates a database with the information. The webpage then is supposed to send a response stating whether the file was imported correctly or not as an XML document. However everytime i try to send the respone i get an error stating: "Thread was being aborted." My code is below.

Any ideas?
private void SendResponse(Boolean success, String errMessage)
        {
            XmlDocument outgoingXML = new XmlDocument();
            String payLoadID = Guid.NewGuid().ToString();
            String curDate = System.DateTime.Now.ToString();
 
            try
            {
                if (success == true)
                {
                    outgoingXML.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE cXML SYSTEM \"http://xml.cXML.org/schemas/cXML/1.1.009/cXML.dtd\"><cXML payloadID=\"" + payLoadID + "\" xml:lang=\"en-US\" timestamp=\"" + curDate + "\"><Response><Status code=\"200\" text=\"OK\"/></Response></cXML>");
                }
                else
                {
                    outgoingXML.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE cXML SYSTEM \"http://xml.cXML.org/schemas/cXML/1.1.009/cXML.dtd\"><cXML payloadID=\"" + payLoadID + "\" xml:lang=\"en-US\" timestamp=\"" + curDate + "\"><Response><Status code=\"500\" text=\"" + errMessage.ToString() + "\"/></Response></cXML>");
                }
                Response.Write(outgoingXML.OuterXml);
                Response.End();
            }
            catch (XmlException ex)
            {
                _status = "1;Error : XML Response " + ex.Message.Trim();
                System.IO.File.WriteAllText(_errorFile, _status);
            }
        }
ASKER CERTIFIED SOLUTION
Avatar of Praveen Venu
Praveen VenuFlag of India imageTechnical Project Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers