Reputation: 295
Just a simple question that I need answering as I'm getting some strange results.
So yeah as the question suggests there is an external site that will post a form to my MVC ActionResult but its never hitting my site the code below should work right?
[HttpPost]
public ActionResult TestResponse(FormCollection collection)
{
return RedirectToAction("PaymentSuccess", new { refId = "Test Ref" });
}
or even this should work right?
[HttpPost]
public ActionResult TestResponse()
{
return RedirectToAction("PaymentSuccess", new { refId = "Test Ref" });
}
its driving me mad...
Upvotes: 1
Views: 551
Reputation: 295
Sorry this was my error missing a field from the post form to the payment gateway just wish they had better error handling... Thanks for the help tho.
Upvotes: 0
Reputation: 11
How are you posting from the other site? Is it through ajax request? If so, check the error you get through onerror attribute.
And to your question, cross domain post is not allowed by default in MVC. You may need to trick MVC by inserting a Header as below through action filter. Access-Control-Allow-Origin : *
But BEWARE, I wouldn't advice this as your site would become susceptible to cross site scripting.
Upvotes: 1