private static string[] RawQueryStringParts(HttpRequestBase request)
 {
     var query = request.RawQueryString();
     query = query.StartsWith("?", StringComparison.OrdinalIgnoreCase)
                 ? query.Substring(1)
                 : query;
     return query.Split('&', StringSplitOptions.RemoveEmptyEntries);
 }
Beispiel #2
0
        public ActionResult Negotiate(HttpRequestBase request,
                                      Type controller)
        {
            if (null == request)
            {
                throw new ArgumentNullException("request");
            }

            var supported = SupportedContentTypes(controller);
            ActionResult result = ContentTypes
                .Where(supported.ContainsKey)
                .Select(type => request.Path.Append(".", supported[type], request.RawQueryString()))
                .Select(location => new SeeOtherResult(location))
                .FirstOrDefault();

            return result ?? new NotAcceptableResult();
        }