Search code examples
asp.netpost-redirect-get

Post-Redirect-Get in ASP.NET


i do Postback in my Page1.aspx to another page. If a press F5 key in Page1.aspx its appears the message (To display the webpage again, Internet Explorer needs to resend the information you've previously submitted. If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again.)

I have this javascript code, which is the solution for my issue ??

thanks in advance

function calc() 
{
    var pagoConPopup = true;

    if (pagoConPopup) 
    {
        var ventanaTPV = window.open('', 'ventanaTPV', 'width=725,height=600,scrollbars=no,resizable=yes,status=yes,menubar=yes,location=yes');

        if (ventanaTPV == null || !ventanaTPV || typeof (ventanaTPV) == "undefined") 
        {
            alert("Se ha detectado bloqueador de ventanas emergentes. Desactívelo para proceder al Pago");
        }
        else 
        {
            document.forms[0].target = 'ventanaTPV';
            hacerSubmitPOST();
            ventanaTPV.focus();
        }
    }
    else 
    {
        hacerSubmitPOST();        
    }
}


function hacerSubmitPOST() 
{
    //*** Prueba de Hack ***
    //alert('Prueba de hack Amount');
    //document.getElementById("Amount").value = "12000";
    //*** Fin Prueba de Hack ***
    document.forms[0].action = '<%=strURLTpvVirtual%>';
    document.forms[0].submit();    
}

Solution

  • If after the redirect, the URL still says Page1.aspx, then in fact the redirect did not happen, since the URL would change to whatever the other page's URL is. Post your server-side code so we can look at where the Redirect should be happening.