400 BadRequest response with .NET Core but not .NET Framework

Viewed 498

I had the link http://www.swensens.com.vn/#huong-vi-tinh-yeu which I need to validate that it's still working or not by request and getting the StatusCode.

It's simple like that

var client = new HttpClient();
var result = await client.GetAsync(@"http://www.swensens.com.vn/#huong-vi-tinh-yeu");           
Console.Write(result.StatusCode);

When I tested with .NET Core 2.1, it gets 400 Bad Request. I suspect the "#huong-vi-tinh-yeu" may cause the problem because I received 200 OK without them. But when I tested it again in .NET Framework, the full link is perfectly getting 200 OK with no problem occurred.

I also tested by using 3rd library such as Flurl, RestSharp in .NET Core but the results are only one with 400 Bad Request.

Another testing on the website https://httpstatus.io still 200 OK 1

I want to keep .NET Core because my current Azure Function system is written through .NET Core.

So what is the problem is?

1 Answers
Related