Andrew B Schultz
Andrew B Schultz

Reputation: 1512

CANNOT get access to HttpRequestMessageExtensions

This is driving me crazy - I can't find any documentation anywhere stating any special things I might be missing to have access to this class.

This says there's no extension method called GetQueryNameValuePairs for HttpRequestMessage:

var token = request.GetQueryNameValuePairs().SingleOrDefault(x => x.Key == OAuthConstants.AuthorzationParam).Value;

Here are my usings:

using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using GoodBreaksClasses;
using GoodBreaksTypes;
using Newtonsoft.Json;
using OAuth2.Mvc;
using System.Web.Http.ValueProviders;
using System.Net.Http.Formatting;

Some of these I don't need, but I was trying to find the library that would work for me; I know System.Web.Http should be enough ...

Has anyone seen this before???

Upvotes: 5

Views: 4087

Answers (2)

zapoo
zapoo

Reputation: 1589

From Nuget Packages install

Microsoft Asp.Net WebApi 2.2 Client Libraries
Microsoft Asp.Net WebApi 2.2 Core Libraries

After install you may create response like

public HttpResponseMessage Call(HttpRequestMessage RequestMessage)
    {
        return RequestMessage.CreateResponse(HttpStatusCode.OK, "Your Data Here"); 
    }

Upvotes: -1

Andrew B Schultz
Andrew B Schultz

Reputation: 1512

finally figured this out. Had to update WebApi, the version I had was too old. This is the update I did: Updating 'Microsoft.AspNet.WebApi' from version '4.0.20505.0' to '4.0.20710.0'.

Upvotes: 3

Related Questions