Skip navigation

Bug - Safari resends same form after redirect

1057 Views 3 Replies Latest reply: May 9, 2012 7:29 AM by Jehran RSS
Jehran Calculating status...
Currently Being Moderated
May 2, 2012 12:55 PM

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, Windows 7

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.