I am testing a payment provider (SagePay) and, as part of the process, their POST servers to my site and expect a response. I cannot get this to work using MVC.
I created a classic asp test response page and added it to my MVC application:
<%
Response.Buffer = True
response.Clear()
response.contenttype="text/plain"
response.write "Status=OK" & vbCRLF
response.write "RedirectURL=http://www.redirectsomewhere.co.uk" & vbCRLF
response.End()
%>
This work is wonderful.
However, when I try to do the same with MVC, it does not work:
Controller:
[HttpPost]
public ActionResult TestCallback()
{
return View();
}
View:
@{
Response.Buffer = true;
Response.Clear();
Response.ContentType = "text/plain";
Response.Write("Status=OK" + System.Environment.NewLine);
Response.Write("RedirectURL=http://www.redirectsomewhere.co.uk" + System.Environment.NewLine);
Response.End();
}
The error message is a common error of the payment provider, so this is not real help, but I narrowed the error down to the point where the page is displayed.
I can view both pages in order (I need to remove the HttpPost attribute from the MVC controller method for this), and both pages display identical data.
This is the MVC URL that the payment provider performs POSTing:
http:
URL- ASP, :
http:
"Token" asp, URL- .
?
UPDATE
Firefox "Header Spy", :
Response HTTP/1.1 200 OK
Source: Response
HttpHeader:Server
Request:User-Agent Cookie
Response:Response Date Set-Cookie
.