3 Replies Latest reply: May 9, 2012 7:29 AM by Jehran
Jehran Level 1 Level 1 (0 points)

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