First lets look in to the Architecture of this web application which I was working on:
The user will be redirected to a static HTML landing pagefrom where the user selects products using radio buttons and hits an htmlbutton which is coded as follows:
<input name="image" type="image" src="../Images/buynow.jpg" class="buynowbutton_and" id="BuyNow_0" onclick="return Redirect(this);"/>
As you can see, when the button is clicked, the javascriptmethod Redirect() is being called.
In this method, a url is constructed using the selected productids and redirected to the shopping cart page.
document.forms[0].action= url;
document.forms[0].submit();
Now the missing piece is that we should return a “false”after the redirection statement. This will prevent the page from posting back again(which we don’t want to happen) aswe already redirected the page.
In my case there was an if else loop in the Redirect()method which was causing the issue.
As you saw above the return false was not in if block, itsonly in else block. This code used to work initially and suddenly started tocreate issues.