How does one configure HttpClient not to automatically redirect when it receives a 301 HTTP Status Code?

Try:

var handler = new HttpClientHandler() 
{
    AllowAutoRedirect = false
};

HttpClient client = new HttpClient(handler);

Leave a Comment