Reputation: 9571
I am building an e-commerce application using the eWay payment portal and I've run into an odd issue.
In my setup for eWay, I am giving a redirect URL for the payment gateway to use to come back to my application. This works correctly and at the end of the callback method I am using RedirectToAction
to redirect to a Confirmation
view.
However, after the callback method completes, it is called again. Only the second time will the redirect to my confirmation page complete properly.
Looking in Fiddler I appear to get a correct 302
response from my callback method to my confirmation view, however I get an icon that is the Session was aborted by the client, Fiddler, or the Server
. Note that this still occurs when Fiddler is closed.
My callback method:
public ActionResult PurchaseCallback(string accessCode)
{
// payment processing
.....
return RedirectToAction("Confirmation");
}
public ActionResult Confirmation()
{
return View("Confirmation");
}
Fiddler trace:
Fiddler trace showing request and response headers:
Note the call to /Purchase/Purchase
which redirects to the eWay portal, before the tunnel to eWay itself, before returning to Purchase/PurchaseCallback
twice before finally arriving at /Purchase/Confirmation
. Also note the icon on the first /PurchaseCallback
call, which indicates an aborted session. However I don't know why it would be aborted.
There is no associated view for PurchaseCallback
and the view for Confirmation
has no JavaScript or other requests. I am using IIS Express, but I am using the RedirectToAction
pattern in many other places without issue.
What would be causing my controller method to be called twice, and how can I stop it happening?
Upvotes: 1
Views: 1322
Reputation: 8415
Check if you have the "Redirect after payment processing" option enabled in you eWAY Shared Page settings (doco here). Sometimes this can create a call to the redirect page before/just after you've clicked on the button, which would create two calls (this is particularly a problem if the delay is set to 5 seconds).
Upvotes: 3