Table of Contents

Class TimeoutHttpClient

Namespace
combit.Reporting.DataProviders
Assembly
combit.ListLabel31.CrossPlatform.dll
[Browsable(false)]
public class TimeoutHttpClient : HttpClient, IDisposable
Inheritance
TimeoutHttpClient
Implements
Inherited Members

Constructors

TimeoutHttpClient(int, ICredentials?)

Initializes a new instance of the TimeoutHttpClient class with the specified timeout in seconds.

public TimeoutHttpClient(int timeoutInSeconds = 10, ICredentials? credentials = null)

Parameters

timeoutInSeconds int

The timeout in seconds.

credentials ICredentials

The network credentials to use for authentication.

Properties

Encoding

Gets or sets the encoding used for the response content.

public Encoding Encoding { get; set; }

Property Value

Encoding

FileName

Gets or sets the file name of the downloaded file.

public string? FileName { get; }

Property Value

string

Methods

GetRequestAsByteArray(string)

Sends a GET request to the specified URL and returns the response content as a byte array.

public byte[] GetRequestAsByteArray(string url)

Parameters

url string

The URL to send the request to.

Returns

byte[]

The response content as a byte array.

GetRequestAsString(string)

Sends a GET request to the specified URL and returns the response content as a string.

public string GetRequestAsString(string url)

Parameters

url string

The URL to send the request to.

Returns

string

The response content as a string.

PostRequest(string, string, string)

Sends a POST request to the specified URL with the provided content.

public string PostRequest(string url, string content, string mediaType = "application/json")

Parameters

url string

The URL to send the request to.

content string

The content to send in the request.

mediaType string

The media type of the content. Default is "application/json".

Returns

string

The response from the server as a string.

PostRequestMultiData(string, string)

Sends a multi-part POST request to the specified URL.

public string PostRequestMultiData(string url, string postData)

Parameters

url string

The URL to send the request to.

postData string

The data to include in the request body.

Returns

string

The response from the server as a string.

TryEnableModernTlsSupport()

Tries to enable modern TLS support.

public static void TryEnableModernTlsSupport()