protected string CreateContentMd5Hash(HttpRequestMessage request)
        {
            if (request != null && request.Content != null)
            {
                byte[] contentBytes = request.Content.ReadAsByteArrayAsync().Result;

                if (contentBytes != null && contentBytes.Length > 0)
                {
                    return(_hmac.CreateContentMd5Hash(contentBytes));
                }
            }
            return("");
        }
Beispiel #2
0
        protected string CreateContentMd5Hash(HttpRequestBase request)
        {
            if (request != null && request.InputStream != null)
            {
                request.InputStream.Position = 0;

                using (var reader = new StreamReader(request.InputStream))
                {
                    string content = reader.ReadToEndAsync().Result;

                    if (content.HasValue())
                    {
                        byte[] contentBytes = Encoding.UTF8.GetBytes(content);

                        if (contentBytes != null && contentBytes.Length > 0)
                        {
                            return(_hmac.CreateContentMd5Hash(contentBytes));
                        }
                    }
                }
            }
            return("");
        }