title: Internationalization in master pages in .NET
body: <p>I'm doing some internationalization for first time, and I have an issue:</p>
  
  <p>I would like to know if it is possible to internationalize from a master page. I added a dropdown list with some languages and I'm using a session , so when I change a language, the new Culture is detected and it changes, the page is reloaded and the contents (I'm using resources) translated. But it's not working.</p>
  
  <p>Here I attach some code:</p>
  
  <p>--Modules.master.vb--</p>
  
  <pre><code>    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
      _Website = clsWebsiteDA.GetById(CInt(Request.QueryString("web")))
      If Not Session("cms_language") Is Nothing Then
          LanguageDropDownList1.SelectedValue = Session("cms_language")
          Dim sCulture As String = Session("cms_language")
          Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sCulture)
          Thread.CurrentThread.CurrentUICulture = New CultureInfo(sCulture)
      End If
  End Sub
  
      Protected Sub LanguageDropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LanguageDropDownList1.SelectedIndexChanged
      Session("cms_language") = LanguageDropDownList1.SelectedValue
      Response.Redirect(Request.Url.ToString)
  End Sub
  </code></pre>
  
  <p>End Class</p>
  
  <p>--Modules.master(aspx)--</p>
  
  <pre><code>                    &lt;asp:DropDownList ID="LanguageDropDownList1" runat="server" AutoPostBack="True" 
                              Height="16px" Width="65px" 
                              meta:resourcekey="LanguageDropDownList1Resource1"&gt;
                      &lt;asp:ListItem Value="nl" meta:resourcekey="ListItemResource1"&gt;Dutch&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Value="fr" meta:resourcekey="ListItemResource1"&gt;French&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Value="es" meta:resourcekey="ListItemResource2"&gt;Spanish&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Value="en" meta:resourcekey="ListItemResource3"&gt;English&lt;/asp:ListItem&gt;
                  &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>If it cannot be done like this, what is the proper approach?
  Thanks in advance,</p>
  
  <p>Alf.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I found through this <a href="http://forums.asp.net/t/1337798.aspx" rel="nofollow">link</a> the solution that I think that fits with my problem. But now I have a problem of inheritance.
  I created in the folder a new WebForm called Basepage.aspx:</p>
  
  <pre><code>Imports System.Globalization
  </code></pre>
  
  <p>Imports System.Threading</p>
  
  <p>Partial Class Basepage
      Inherits System.Web.UI.Page</p>
  
  <pre><code>Protected Overrides Sub InitializeCulture()
      If Request.Form("DropDownList1") IsNot Nothing Then
          Dim selectedLanguage As String = _
              Request.Form("DropDownList1")
          UICulture = Request.Form("DropDownList1")
          Culture = Request.Form("DropDownList1")
          Thread.CurrentThread.CurrentCulture = _
              CultureInfo.CreateSpecificCulture(selectedLanguage)
          Thread.CurrentThread.CurrentUICulture = New  _
              CultureInfo(selectedLanguage)
      End If
      MyBase.InitializeCulture()
  End Sub
  </code></pre>
  
  <p>End Class</p>
  
  <p>But, when I subtitute for example, in one of my pages,</p>
  
  <pre><code>Partial Class Administration_index
  Inherits System.Web.UI.Page
  </code></pre>
  
  <p>for</p>
  
  <pre><code>    Partial Class Administration_index
  Inherits Basepage
  </code></pre>
  
  <p>it complains saying that it's not defined. How can I deal with this inheritance?
  VB appreciated,though C# is ok...</p>