I am trying to get the default language from the browser and I use the following code to get it:
var languages = HttpContext.Request.UserLanguages;
You need to add the localisation middleware to be able to get the IRequestCultureFeature
feature:
public void Configure(IApplicationBuilder app)
{
//...
//Add this:
app.UseRequestLocalization();
//...
}
Now in your controller you can request the feature like this:
var requestCulture = Request.HttpContext.Features.Get();