Hey Guys!! In this tutorial, I am going to explain you, how to read user’s cultural language and redirect the user’s page according to that regional/country language.

My Concept: - Both the request object’s User Languages and the CulturalInfo class’s Name property return culture information into two parts. The first two letters are the language code. Depending upon the language code, I will be redirecting the user according to his/her regional/Country language.

<form id="form1" runat="server">
    <asp:Label ID="lblCulture" runat="server" ></asp:Label>

(However,I am not going to use this label..Let it be there J J)



Don’t forget to add the namespace System.Globalization. Use VB Or C# use this lines to add the namespace.


Using System.Globalization; (C#)

Import System.Globalization (VB)

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Globalization;
public partial class Default2 : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        //Get the user's preferred language
        string sLang =Request.UserLanguages[0];
        //Get the first two characters of the language
        sLang= sLang.Substring(0, 2);   
 //Redirect user based culture
        switch (sLang)
            case "en":
                //use US Site
            case "es":
                //use Spanish Site
            case "de":
                //use German Site
            case "zh":
                //use Chinese Site


On running this sample code,you will be directly redirected to the corresponding language.Just post back a reply if this article was useful for you. Thanks for reading my article. Happy Coding.Explore more and more as much as possible.

  Modified On Nov-30-2017 12:43:07 AM

Leave Comment