Thread was being Aborted Create XML RRS feed

  • Question

  • User728122777 posted

    Hi All

    My Requirement is to retrieve data from database and display it on google map (Java script)

    i made a javascript function to get data from code behind using XML

    it work the first time when it retrieve the markers

    but when click the marker the same function show exception Thread was being Aborted

    on the last line Response.End

    First Retrieve Markers (Works)

      downloadUrl("Queries.aspx" + ID, function (data) {
                        var xml = data.responseXML;
                        var markers = xml.documentElement.getElementsByTagName("Marker");
                        for (var i = 0; i < markers.length; i++) {
                      var Lng= markers[i].getElementsByTagName("Lng")[0].childNodes[0].nodeValue;
                       var Lat= markers[i].getElementsByTagName("Lat")[0].childNodes[0].nodeValue;

    Marker Click (Not Working)

      downloadUrl("Queries.aspx?Action=CarLocation&CarId=" + ID, function (data) {
                        var xml = data.responseXML;
      var markers = xml.documentElement.getElementsByTagName("Marker");
                        for (var i = 0; i < markers.length; i++) {
                       var CarName = markers[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
                       var PlatNumber = markers[i].getElementsByTagName("PlateNO")[0].childNodes[0].nodeValue;
                     var CarModelName = markers[i].getElementsByTagName("ModelName")[0].childNodes[0].nodeValue;
                            var IMEI = markers[i].getElementsByTagName("IMEI")[0].childNodes[0].nodeValue;

    downloadUrl Function

     function downloadUrl(url, callback) {
                var request = window.ActiveXObject ?
                    new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;
                request.onreadystatechange = function () {
                    if (request.readyState == 4) {
                request.open('GET', url, true);


      private void CreateXML(DataTable dt)
                Response.ContentType = "text/xml";
                XmlTextWriter TextWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
                foreach (DataRow oFeedItem in dt.Rows)
                    foreach (DataColumn oo in dt.Columns)
                        TextWriter.WriteElementString(oo.ColumnName, oFeedItem[oo.ColumnName].ToString());

    Thursday, November 17, 2016 8:19 AM

All replies

  • User-707554951 posted

    Hi MaherKhalil.

    As far as I know, If you spawn threads in Application_Start, they will still be executing in the application pool's AppDomain. If an application is idle for some time (meaning that no requests are coming in), or certain other conditions are met, ASP.NET will recycle the entire appdomain. When that happens, any threads that you started from that AppDomain, including those from Application_Start, will be aborted.

    ASP .Net methods like Response.End or Response.Redirect (unless you pass false) throw this exception to end processing of the current page.

    ASP .Net itself handles this exception and calls ResetAbort to continue processing.

    I suggest you could try to replace  Response.End() with following cdoe:

    HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.

    For more information, please refer the following link:


    Best regards


    Friday, November 18, 2016 8:37 AM
  • User728122777 posted

    thank you for the answer

    indeed there was no error after using


    but the xml document always return null 

    Friday, November 18, 2016 9:28 PM