Embed language code in URL of an ASP.NET webpage (CSASPNETEmbedLanguageInUrl)

The ASP.NET code sample demonstrates embedding language code in URL of a webpage. For example, http://domain/en-us/ShowMe.aspx. The page displays localized content according to the language code in URL.

C# (63.5 KB)
4 Star
15,561 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Is there a VB version available, and would it benefit me?
    1 Posts | Last post January 31, 2012
    • I have a website, www.ussvision.com, made in Visual Studio 2010 / vb / asp.net 4.0.  I am not a programmer, but I managed to localize it in 8 different languages.  I have 8 different LocalizedText.resx files in my Apps_GlobalResources folder.  I have the links on my homepage set up as this, for instance:
            <asp:LinkButton ID="LinkButton5" runat="server"
            CommandArgument="fr" OnClick="RequestLanguageChange_Click"
            <asp:Image ID="Image6" runat="server" ImageUrl="~/images/flagfr.png"
            tooltip="Voir ce site en français" title="Voir ce site en français"/>
            <img class="map" src="images/flaghoverfr.png" alt=""/>
      When you click the French flag, the text on the page will turn to French and it will last the entire session.  But the URL does NOT change.  So http://www.ussvision.com/about.aspx will remain that; it's just using a different resource file to display the text.
      I've been told it's better for SEO to have my domain changing to, in this case, something like http://www.ussvision.com/FR/about.aspx.  Assuming this is better, can I accomplish this with your tool, even though my site is in VB?
      Jason Weber