- POSTing to my ASP.NET MVC app from 3rd party site
- <%
- 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()
- %>
- [HttpPost]
- public ActionResult TestCallback()
- {
- return 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();
- }
- http://myipaddress/CA_UAT/Token/TestCallback
- http://myipaddress/CA_UAT/Token/TestCallback.asp
- Response HTTP/1.1 200 OK
- Source: Response
- HttpHeader:Server
- Request:User-Agent Cookie
- Response:Response Date Set-Cookie
- [HttpPost]
- public string TestCallback()
- {
- string result = "Status=OK";
- result += System.Environment.NewLine;
- result += "RedirectURL=http://www.redirectsomewhere.co.uk";
- result += System.Environment.NewLine;
- return result;
- }
- [HttpPost]
- public ActionResult TestCallback()
- {
- 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.Flush();
- return new EmptyResult();
- }
- [HttpPost]
- public ActionResult TestCallback()
- {
- var sb = new StringBuilder();
- sb.AppendLine("Status=OK");
- sb.AppendLine("RedirectURL=http://www.redirectsomewhere.co.uk");
- return Content(sb.ToString(), "text/plain");
- }
- public class ResponseViewModel
- {
- public string Status { get; set; }
- public string RedirectUrl { get; set; }
- }
- public class StatusActionResult : ContentResult
- {
- private readonly ResponseModel _model;
- public StatusActionResult(ResponseModel model)
- {
- _model = model;
- }
- public override void ExecuteResult(ControllerContext context)
- {
- var response = context.HttpContext.Response;
- response.ContentType = "text/plain";
- response.Write(string.Format("Status={0}{1}", _model.Status, Environment.NewLine));
- response.Write(string.Format("RedirectURL={0}", _model.RedirectUrl));
- }
- }
- [HttpPost]
- public ActionResult TestCallback()
- {
- var model = new ResponseModel
- {
- Status = "OK",
- RedirectUrl = "http://www.redirectsomewhere.co.uk"
- };
- return new StatusActionResult(model);
- }