Accessing QueryString in a custom AuthorizeAttribute

NameValueCollection queryString = actionContext.Request.RequestUri.ParseQueryString();

It works for me.


Try

using System.Web;

HttpContext.Current.Request.QueryString

While Adam Tal's answer is perfectly valid, in the Web API new world order you really do not want to use anything from the System.Web namespace; in fact you don't even want to reference it. Alas you can get to the querystring from the GetQueryNameValuePairs() extension method. That will let you cut System.Web boat anchor loose and still get to what you need.

using System.Net.Http;

var queryString = actionContext.Request
        .GetQueryNameValuePairs()
        .ToDictionary(x => x.Key, x => x.Value);