Answer the question
In order to leave comments, you need to log in
Why does HttpClient.GetAsync incorrectly use a "#" reference?
I am new to programming.
According to the lesson on YouTube, I made a parser for article titles on the Habrahabr website.
The parser works correctly with links https://habrahabr.ru/page1/ and further 2, 3 pages. Goes through them and takes all the headings of the articles.
I changed the links to the Steam site so that the parser selects the names of the items on its pages.
Successfully getting the result as a list of items, but from the wrong page. If I understand correctly, then the link to the page "breaks" in GetAsync.
A piece of code
var currentUrl = url.Replace("{CurrentId}", id.ToString());
Process.Start(currentUrl);
var response = await client.GetAsync(currentUrl);
Answer the question
In order to leave comments, you need to log in
After the # symbol, a local fragment (or anchor ) of the page is indicated - an element within the page that the browser uses to navigate the page. Also used for local (client) page settings.
In your case, the sort type p1_name_asc is specified after # - sort the table by name in ascending order. For example, to sort in descending order, you can put the type p1_name_desc.
The problem is that the sorting happens in the browser, not on the server (the server won't see that part of the address at all).
If you need to get the list exactly as indicated in the link, then you must also sort the result after receiving the list.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question