Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Bug - Safari resends same form after redirect

I am currently experiencing a bug that only occurs in the current version of Safari.

The bug requires three pages, I'll show the source of them and then explain what is going on:

FirstPageWithForm.htm

<form id="theForm" action="ActionHandler.ashx" method="post">

   <input type="hidden" name="differentField" value="1234"/>

   <input type="hidden" name="sameField" value="1111"/>

</form> 

<script type="text/javascript">

   var theForm = document.getElementById("theForm");

   theForm.submit();

</script>

SecondPageWithForm.htm

<form id="theForm" action="ActionHandler.ashx" method="post">

    <input type="hidden" name="differentField" value="5678"/>

    <input type="hidden" name="sameField" value="1111"/>

</form> 

<script type="text/javascript">

   var theForm = document.getElementById("theForm");

   theForm.submit();

</script>

ActionHandler.ashx

public void ProcessRequest(HttpContext context) {

   var referrer = context.Request.UrlReferrer;

   var differentField = context.Request["differentField"];

   context.Response.Write(differentField);

   if (differentField == "1234") {

      if (referrer.ToString().Contains("Second"))

          context.Response.Write("Failure");

      else

          context.Response.Redirect("SecondPageWithForm.htm");

   }

   else

      context.Response.Write("Success"); }

As you notice both forms have the same field name but one of the fields has a different value. However, in Safari when this code is run, the value

"1234"
is sent as
differentField
instead of
"5678"
for the second page. I do not believe this bug has anything to do with .NET but I don't have an easy way to test another language to be sure about that.

Safari-OTHER, Windows 7

Posted on May 2, 2012 12:55 PM

Reply
3 replies

Bug - Safari resends same form after redirect

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.