• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

ASP.NET + PayPal + IE10 problem

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    ASP.NET + PayPal + IE10 problem

    I've had a few reports of a shopping basket system I implemented a few years ago in C# ASP .NET not working with IE10. This is .NET 2.0, and compiled now with VS2010 Pro but originally 2005. Predictably it works fine when I debug it on my laptop in both debug and release, but doesn't work on the old IIS6 server.

    This is what should happen:

    1. The user goes to a pay page called DoDirectPayment.aspx with fields for name, address, credit card numbers etc. Then they press a submit button. The submit button has a client side script which disables itself and changes its text to "Please wait".

    2. The submit button should call PayButton_Click function on the server, which sets session variables and does Response.Redirect("DoHostedPayment2.aspx");

    3. DoHostedPayment2.aspx displays "contacting payment provider" and has an invisible form which is filled out by the server and posted immediately to PayPal with some client side JS.

    4. PayPal displays its customised page with our logo etc.

    With IE10, the redirect to DoHostedPayment2.aspx doesn't appear to work. The submit button correctly disables itself, and changes its text, and then the same page reloads (with the submit button enabled again). So I'm guessing it isn't managing to call the onClick handler on the server.

    Code:

    Code:
            private void Page_Load(object sender, System.EventArgs e){
                System.Text.StringBuilder sbValid = new System.Text.StringBuilder();
                sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { ");
                sbValid.Append("if (Page_ClientValidate() == false) { return false; }} ");
                sbValid.Append("this.value = 'Please wait...';");
                sbValid.Append("this.disabled = true;");
                sbValid.Append("document.all.PayButton.disabled = true;"); // this much must be working
    
                //GetPostBackEventReference obtains a reference to a client-side script function that causes the server to post back to the page.
                sbValid.Append(this.Page.GetPostBackEventReference(this.PayButton));
    
                sbValid.Append(";");
                this.PayButton.Attributes.Add("onclick", sbValid.ToString());
    I'm getting a warning that GetPostBackEventReference is obsolete, but surely as all this predates IE10 by a number of years that can't be the reason?

    This is what it generates on the client onClick handler:

    Code:
    __doPostBack('PayButton','');
    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("PayButton", "", true, "", "", false, false))
    I don't really understand by what voodoo the above makes the server call its PayButton_Click handler, but it does in the other browsers, and does in the debugger.

    Does anyone know what's going on here?
    Will work inside IR35. Or for food.

    #2
    Possible cause:

    Bug and Fix: ASP.NET fails to detect IE10 causing _doPostBack is undefined JavaScript error or maintain FF5 scrollbar position - Scott Hanselman

    Comment


      #3
      Many thanks. Don't get any script errors, but otherwise that makes a lot of sense. The hotfix wouldn't install on the server, but I don't think it even has .NET2 SP2 installed, so I need to do some updating and cross fingers it doesn't all break.
      Will work inside IR35. Or for food.

      Comment

      Working...
      X