I've read multiple similar posts on this. For example:
But none provided the solution for me. I have an idea what is going wrong, and I'll try to walk through my code.
This only happens to a handful of users a day, and all of them use IE. Firefox works as it should.
I have one aspx page which holds a registration form for my webshop. When the user clicks "Proceed," I do a postback which validates data. If everything is valid, I run this code:
public void Proceed(Object sender, EventArgs e)
{
if (IsValid)
{
SaveCustomerInfo();
ScriptManager.RegisterStartupScript(
this, this.GetType(),
"RedirectPaymentGateway",
"RedirectPaymentGateway('" + paymentData + "');", true);
}
}
This script redirects the user to the payment gateway like this:
function RedirectPaymentGateway(paymentData) {
$(document).ready(function() {
try {
var div = document.createElement('div');
div.innerHTML = paymentData;
var formDataObj = jQuery.parseJSON(div.firstChild.nodeValue);
var form = "<form>FORM CONSTRUCTION</form>";
$('#pnlPaymentGateway').html(form);
$('#pnlPaymentGateway').submit();
}
catch (e) {
alert(e);
}
});
}
(paymentData
is a JSON serialization of a .net object.)
I'm guessing this code breaks something related to the viewstate, but I can't figure out how or why. Any suggestions?