1

I used to export data as excel files on server side, now I am trying to do it by using webservices.

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void exportProduct(parameters)
{
    // ... other code ...
    ExportToExcel(ds.Tables[0], filename);
}

public static void ExportToExcel(object x, string filename)
{
    // ... other code ...
}   

But I am getting this error:

Thread was being aborted

However, everything works just fine when I try this URL:

http://localhost:37407/WebServices/WebServiceProduct.asmx?op=exportProduct

Something must be wrong between client-side and the webservice, but I couldn't find it.

Here's the client-side code. I have been just calling webservice but that's all.

function exportToExcel() {
    webService._staticInstance.exportProduct(orderby, filter, function() {
    });
}
3
  • In which part of the code are you getting the error... Post that part of code
    – Bhavik
    May 15, 2014 at 17:08
  • in "public static void ExportToExcel(object x, string filename)" part. actually this part in an external cs file. I call it in webmethod, excel file is created in ExportToExcel method and then I am getting error.
    – Adem Ergun
    May 15, 2014 at 17:13
  • You must check this answers.. stackoverflow.com/a/1433486/2260614 and stackoverflow.com/a/7630466/2260614
    – Bhavik
    May 15, 2014 at 17:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.