Esempio n. 1
0
        public static void AddCommmonHeaders(this WebClient request, SharedAccessSignatureTokenProvider provider, string address, bool addContentType = true, bool addAnonHeader = false, bool addIfMatchheader = false, string qaddress = null)
        {
            if (addContentType)
            {
                request.AddContentType();
            }
            if (addAnonHeader)
            {
                request.Headers.Add("X-MS-ISANONYMOUSACCESSIBLE", "False");
            }
            if (addIfMatchheader)
            {
                request.Headers.Add("If-Match", "*");
            }
            request.SetUserAgentHeader();
            request.AddXProcessAtHeader();
            request.AddAuthorizationHeader(provider, address);

            if (!string.IsNullOrWhiteSpace(qaddress))
            {
                request.AddServiceBusSupplementaryAuthorizationHeader(provider, qaddress);
            }

            request.AddTrackingIdHeader(Guid.NewGuid());
        }