Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

asp.net core 6 get current culture in controller

public async Task<IActionResult> Index() {
    // Retrieves the requested culture
    var rqf = Request.HttpContext.Features.Get<IRequestCultureFeature>();
    // Culture contains the information of the requested culture
    var culture = rqf.RequestCulture.Culture;
    return View();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #core #current #culture #controller
ADD COMMENT
Topic
Name
9+5 =