Return LCID From HTTPContext

A friend today asked me if it was possible to pass in the HTTPContext as a parameter into a static helper method to return the LCID of the current web request. It’s actually really easy.

[csharp]

public static int harvestCurrentLCID(HttpContext context)
{
return (int) SPControl.GetContextWeb(context).Language;
}

[/csharp]

That’s pretty much it, it should return an integer that corresponds to the language type that correlates to the LCID of your SharePoint instance.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *