X
X
Xveeder2019-02-01 08:32:32
C++ / C#
Xveeder, 2019-02-01 08:32:32

How to download an image from a link with GET parameters?

Subject.
When downloading an image from this link:

https://domain.com/data/name-docement?k=6&m=903165532&s=612x612&w=0&h=TMnsNyav_kyvQvBaxS9zwpZN4PjInF_t-FlNbuKnO0s=

Downloading the wrong version of the file.
I download the file via new WebClient().DownloadFileAsync(uri, path);
Empirically, it turned out to establish that the file is being downloaded without GET parameters, that is, like this: https://domain.com/data/name-docement
How to fix it?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sir_Akakii, 2019-02-01
@Sir_Akakii

It may be necessary to add the parameters themselves separately, to the QueryString.
That is, if you sketch it quickly, everything should look something like this:

WebClient myWebClient = new WebClient();
myWebClient.QueryString.Add("k", "6");
myWebClient.QueryString.Add("m", "903165532");
myWebClient.QueryString.Add("s", "612x612");
myWebClient.QueryString.Add("w", "0");
myWebClient.QueryString.Add("h", "TMnsNyav_kyvQvBaxS9zwpZN4PjInF_t-FlNbuKnO0s=");
myWebClient.DownloadFileAsync("https://domain.com/data/name-docement", path);

Those. all required parameters must be set separately.
More details here - https://docs.microsoft.com/ru-ru/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question