SalesForceBackup/SalesForceWebDownloader.cs
/// <summary>
/// Retrieves a page from SalesForce.
/// </summary>
/// <param name="url">The full URL for the SalesForce page.</param>
/// <param name="sessionId">The current session ID.</param>
/// <returns>An HttpResponseMessage for the url.</returns>
/// <remarks>
/// SalesForce requires that you populate an organizationId and sessionId for authenticated requests.
/// </remarks>
Retrieves a page from SalesForce.
Retrieves a page from SalesForce .
private HttpResponseMessage GetSalesForcePage(string url, string sessionId)
        {
            var baseAddress = new Uri(String.Format("{0}://{1}", _appSettings.Get(AppSettingKeys.Scheme), _appSettings.Get(AppSettingKeys.Host)));
            using (var handler = new HttpClientHandler { UseCookies = false })
            using (var client = new HttpClient(handler) { BaseAddress = baseAddress })
            {
                var message = new HttpRequestMessage(HttpMethod.Get, url);
                message.Headers.Add("Cookie", String.Format("oid={0}; sid={1}", _appSettings.Get(AppSettingKeys.OrganizationId), sessionId));
                return client.SendAsync(message).Result;
            }
        }
private HttpResponseMessage GetSalesForcePage ( string url , string sessionId ) { var baseAddress = new Uri ( String . Format ( " " , _appSettings . Get ( AppSettingKeys . Scheme ) , _appSettings . Get ( AppSettingKeys . Host ) ) ) ; using ( var handler = new HttpClientHandler { UseCookies = false } ) using ( var client = new HttpClient ( handler ) { BaseAddress = baseAddress } ) { var message = new HttpRequestMessage ( HttpMethod . Get , url ) ; message . Headers . Add ( " " , String . Format ( " " , _appSettings . Get ( AppSettingKeys . OrganizationId ) , sessionId ) ) ; return client . SendAsync ( message ) . Result ; } }
Retrieves a page from SalesForce.
Retrieves a page from SalesForce .
An HttpResponseMessage for the url.
An HttpResponseMessage for the url .
url
string
The full URL for the SalesForce page.
The full URL for the SalesForce page .
sessionId
string
The current session ID.
The current session ID .
remarks
SalesForce requires that you populate an organizationId and sessionId for authenticated requests.
SalesForce requires that you populate an organizationId and sessionId for authenticated requests .