Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need a help only IE case.

I have created a flight booking website and after selecting flight I have redirect to booking Page. I have create a webmethod in fligh booking page and this webmethod calling from ajax. After Click on book button then ajax function hit the webmethod function and create booking successfully when i check log but response is still pending and after wait approx 10 min its give below message

{\"Message\":\"Authentication failed.\",\"StackTrace\":null,\"ExceptionType\":\"System.InvalidOperationException\"}{\"d\":\"Success^\"}

Unauthorized

Please find the below code : ajax (.ASPX Page)

Javascript:
<pre lang="Javascript">var ossrDetail=$("[id$=hdnOSSRDetail]").val();
        var issrDetail=$("[id$=hdnOSSRDetail]").val();
        if(payment==undefined || payment==null)
            payment="";
        var DTO = { 'OSSRDetail': ossrDetail, 'ISSRDetail': issrDetail,'Currency': currency, 'CardCompany': ddlCardCompany,     'CardNo': txtCardNo, 'ExpiryDate': txtExpiryDate, 'PaymentMode': payment};
        $.ajax({
            contentType: "application/json;",
            data: JSON.stringify(DTO),
            dataType: "json",
            type: "POST",
            async: false,
            cache: false,
            //contentType: false,
            //timeout: 3000,
            processData: false,
            url: "FLSR_FlightSummary.aspx/BookingRequest",
            success: function (data) {
                if (data.d != "") {
                    var result=data.d;
                    if(result.split("^")[0]=="Success")
                    {
                        window.location=result.split("^")[1];
                    }
                    else
                    {
                        bsuccessAlert(result.split("^")[0])
                        fnShowButton();
                    }
                    fnHideEffect();

                }
                else {
                    fnHideEffect();
                    bsuccessAlert(data.d)
                    fnShowButton();
                }
            },
            complete: function(){
                alert("Hello I am complete");
            },
            error: function (err) {
                fnHideEffect();
                bsuccessAlert(err.statusText);
                fnShowButton();
            }
        });

And code in Flight/FLSR_FlightSummary.apsx VB.Net
C#
<WebMethod(EnableSession:=True)>
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)>
Public Shared Function BookingRequest(ByVal OSSRDetail As String, ByVal ISSRDetail As String, ByVal Currency As String, ByVal CardCompany As String, ByVal CardNo As String, ByVal ExpiryDate As String, ByVal PaymentMode As String) As String

    HttpContext.Current.Session.Remove("IS_Hold_Click")

    Dim f As New Flight_FLSR_FlightSummary
    If f.ISPaymentByCC = True Then
        Dim objPayemtXML As New XmlDocument
        objPayemtXML.LoadXml("<CCDetails CURRENCY='' CARDTYPE='' CARDNO='' EXPIRYDATE='' CCPAYMENTBY=''></CCDetails>")
        objPayemtXML.SelectSingleNode("CCDetails").Attributes("CURRENCY").Value = Currency
        objPayemtXML.SelectSingleNode("CCDetails").Attributes("CARDTYPE").Value = CardCompany
        objPayemtXML.SelectSingleNode("CCDetails").Attributes("CARDNO").Value = CardNo
        objPayemtXML.SelectSingleNode("CCDetails").Attributes("EXPIRYDATE").Value = ExpiryDate
        objPayemtXML.SelectSingleNode("CCDetails").Attributes("CCPAYMENTBY").Value = PaymentMode
        HttpContext.Current.Session("CCPaymentDetails") = objPayemtXML.OuterXml
    End If
    Dim strMessage As String = ""
    Dim strReturnURL As String = ""
    f.FillPaxXml(OSSRDetail:=OSSRDetail, ISSRDetail:=ISSRDetail, Message:=strMessage, strReturnUrl:=strReturnURL)



    If strMessage = "" Then
        strMessage = "Success"
    End If

    Return strMessage + "^" + strReturnURL

End Function


What I have tried:

In above code Complete webmethod is run successfully but response is not END. after waiting long time its gives response is
{\"Message\":\"Authentication failed.\",\"StackTrace\":null,\"ExceptionType\":\"System.InvalidOperationException\"}{\"d\":\"Success^\"}"

Unauthorized


I do not know why this give message but method request is run completely after checking log but response is coming very late. i have also monitor with developer tool and fidder always display POST Pending.
Posted
Updated 7-Oct-22 20:46pm
Comments
Jariwala Amin 8-Oct-22 2:46am    
Did you find any solution? I am also facing this issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900