XML Parsing Error: no element found

Few Days ago, i found strange error like “XML Parsing Error: no element found“.

I was unable to find the exact root cause. Most of the times it happens if you are missing any closing tag in your ASPZ application. I checked my complete page and reconfirmed but error still persist.

somehow i found that ASP.NET treat the response of page as XML document and that’s why we receive XML Parsing Error: no element found error.

so explicitly i set the response type of my page as text/HTML. Response.ContentType = “text/HTML”.

And this line tells the ASPX that page is HTML, not XML.







3 responses to “XML Parsing Error: no element found”

  1. Pulkit Avatar

    where exactly did you add this code?

  2. vivikas- Avatar

    Response.ContentType = “text/HTML
    where to add the above code?

    1. Jitendra Zaa Avatar

      Add this code in C# class behinf ASPX page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.