What am I doing wrong in this code? When I send a POST request to this API i get the 404 error page. Can somebody help me debug this code. New to Rest Api and Twilio.
using System.Web.Mvc;
using Twilio.TwiML.Mvc;
using Twilio.Mvc;
namespace MVC4Test.Controllers
{
public class HomeController : TwilioController
{
[HttpPost]
public TwiMLResult ActionResult(SmsRequest request)
{
string smsTextType = request.Body;
var response = new Twilio.TwiML.TwilioResponse();
Response.ContentType = "text/xml";
response.Redirect("http://www.google.com");
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//Response.Write(smsTest);
return TwiML(response);
//Response.Close();
}
}
}
This is my route
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}