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.

C#:
  1. public static int harvestCurrentLCID(HttpContext context)
  2. {
  3. return (int) SPControl.GetContextWeb(context).Language;
  4. }

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/Bookmark

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment