I am struggling with the HttpResponse.Redirect
method. I thought it would be included in System.Web
but I am getting the
The name 'Response' does not exist in the current context" error.
This is the entire controller:
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
namespace MvcApplication1.Controllers
{
public class SmileyController : ApiController
{
public HttpResponseMessage Get(string id)
{
Response.Redirect("http://www.google.com");
return new HttpResponseMessage
{
Content = new StringContent("[]", new UTF8Encoding(), "application/json"),
StatusCode = HttpStatusCode.NotFound,
};
}
}
}