locked
Request.CreateResponse not showing RRS feed

  • Question

  • User1858009984 posted

    Hi,

    I am not getting the intellisense for Request.CreateResponse in Web.Api for VS 2017. Below attached my code.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using System.Net.Http;
    using Masdar_Service.Models;
    using System.Net;
    using System.Web.Http;
    using System.Net.Http.Formatting;

    namespace Test_Service.Controllers
    {
    public class TestController : Controller
    {

    public HttpResponseMessage Get()
    {
    using (Entities entity = new Entities())
    {
    return Request.CreateResponse(HttpStatusCode.OK, entity.Details.ToList());

    }
    }
    }
    }

    Thursday, November 1, 2018 6:27 AM

All replies

  • User-474980206 posted
    Add using

    using System.Net.Http;
    Thursday, November 1, 2018 2:31 PM
  • User1858009984 posted

    Hi,

    Already the mentioned namespace is included in the code pasted earlier and no solution for it

    Friday, November 2, 2018 5:56 AM
  • User475983607 posted

    My best guess is you are building and ASP.NET Core Web API where Request.CreateResponse is not valid syntax.

            public HttpResponseMessage Get()
            {
                return new HttpResponseMessage(HttpStatusCode.OK);
            }

    Friday, November 2, 2018 1:40 PM
  • User1724605321 posted

    Hi Ravindranath ,

    Or you can provide the detailed project creation steps in vs to help us reproduce your issue .

    Best Regards,

    Nan Yu

    Monday, November 5, 2018 1:45 AM