I have a Web Application that uses ASP.NET AJAX Web Services to asynchroniously call a Web Service to update a Database (amongst other things). My Application will call the Web Service at various points while the user is at a specific page (for example, whenever they press a Button to save changes). Every time it works perfectly fine. However, if I visit the page with FireFox (Version 3) and press the "Next Page" Button which causes a Postback to direct the user to the next page the Web Service will always display the error message below. The Web Service itself however is in fact working given that I can see the data being updated in the Database. Nevertheless FireFox still calls the "Failed" function.
Any idea why this might be the case? The code below should help provide some insight as to whats going on.
Thanks.
Error Code:
The server method 'setData' failed.
Status Code: 0
Timed Out: false
JavaScript Functions:
function saveData()
{
// Note that "proxyObject" is specified earlier. It is a JavaScript Array / .NET Collection of type "CustomData".
WebServiceObject.setData(proxyObject.lstData, successSet, failedSet);
}
function failedSet(error)
{
alert("Stack Trace: " + error.get_stackTrace() + " - Error: " + error.get_message() + " - Status Code: " + error.get_statusCode() + " - Exception Type: " + error.get_exceptionType() + " - Timed Out: " + error.get_timedOut());
}
Script Manager Code:
<asp:ScriptManager runat="server" ID="ScriptManager1">
<Services>
<asp:ServiceReference path="DataSaver.asmx" />
</Services>
</asp:ScriptManager>
DataSaver.asmx Code:
<%@ WebService Language="VB" CodeBehind="~/App_Code/WebServiceObject.vb" Class="WebServiceObject" %>
WebServiceObject.vb Code:
Imports System.Web
Imports System.Web.Services
Imports System.Xml
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports System.Data.SqlClient
Imports System.IO
Imports DataTracking ' Custom Class. Contains Class "CustomData".
' The Class below contains the Web Service methods for saving data in the Database.
' This is necessary in order to allow Silverlight to communicate between the Client and the Server.
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ScriptService()> _
<GenerateScriptType(GetType(CustomData))> _
Public Class WebServiceObject
Inherits System.Web.Services.WebService
<WebMethod(EnableSession:=True)> _
Public Function setData(ByVal newData As Collections.Generic.List(Of CustomData)) As Boolean
' Updates data in the Database.
End Function
End Class