Changing the active culture

Posted by Chanikya under ASP.NET category on | Points: 40 | Views : 1683
Changing the active culture

Both Culture and UICulture is automatically set based on the browser settings of your visitor. Try running the following page:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Culture.aspx.cs" Inherits="Culture" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<form id="form1" runat="server">
<% Response.Write("Your current culture: " + System.Globalization.CultureInfo.CurrentCulture.DisplayName); %>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Culture : System.Web.UI.Page
protected override void InitializeCulture()
Page.Culture = "en-GB";
Page.UICulture = "en-GB";

protected void Page_Load(object sender, EventArgs e)

Now, access your browsers language settings:

Internet Explorer: Click the Tools button, select Internet Options , then click the Languages button.

Firefox: Click the Tools menu, select Options , select the Content tab and then click the Choose button in the Languages group.

Add another language, and then move it to the top of the list. Close the dialog and reload the page (F5). You will now see the name of the culture matching your newly selected language.

Comments or Responses

Login to post response