Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 653931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:26:15+00:00 2026-05-13T22:26:15+00:00

I have a website with three domains .com, .de and .it Each domain needs

  • 0

I have a website with three domains .com, .de and .it

Each domain needs to default to the local language/culture of the country.
I have created a base page and added an InitializeCulture

  Protected Overrides Sub InitializeCulture()

    Dim url As System.Uri = Request.Url
    Dim hostname As String = url.Host.ToString()
    Dim SelectedLanguage As String

    If HttpContext.Current.Profile("PreferredCulture").ToString Is Nothing Then

        Select Case hostname
            Case "www.domain.de"
                SelectedLanguage = "de"

                Thread.CurrentThread.CurrentUICulture = New CultureInfo(SelectedLanguage)
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SelectedLanguage)

            Case "www.domain.it"
                SelectedLanguage = "it"

                Thread.CurrentThread.CurrentUICulture = New CultureInfo(SelectedLanguage)
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SelectedLanguage)

            Case Else
                SelectedLanguage = "en"

                Thread.CurrentThread.CurrentUICulture = New CultureInfo(SelectedLanguage)
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SelectedLanguage)
        End Select
    End If
End Sub

This is fine. The problem now occurs because we also want three language selection buttons on the home page so that the user can override the domain language.

So on my Default.asp.vb we have three button events like this…

Protected Sub langEnglish_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles langEnglish.Click

    Dim SelectedLanguage As String = "en"
    'Save selected user language in profile'
   HttpContext.Current.Profile.SetPropertyValue("PreferredCulture", SelectedLanguage)

    'Force re-initialization of the page to fire InitializeCulture()'
    Context.Server.Transfer(Context.Request.Path)


End Sub

But of course the InititalizeCulture then overrides whatever button selection has been made. Is there any way that the InitialCulture can check whether a button click has occurred and if so skip the routine?

Any advice would be greatly appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:26:16+00:00Added an answer on May 13, 2026 at 10:26 pm
    Protected Overrides Sub InitializeCulture()
    
        'Set the PreferredCulture as the SelectedLanguage by default'
        Dim SelectedLanguage As String = HttpContext.Current.Profile("PreferredCulture").ToString()
    
        'If there is no PreferredCulture, use these defaults'
        If [String].IsNullOrEmpty(SelectedLanguage) = True Then
    
            Select Case Request.Url.Host.ToString()
                Case "www.domain.de"
                    SelectedLanguage = "de"
    
                Case "www.domain.it"
                    SelectedLanguage = "it"
    
                Case Else
                    SelectedLanguage = "en"
    
            End Select
        End If
    
        'Finally set the culture'
        Thread.CurrentThread.CurrentUICulture = New CultureInfo(SelectedLanguage)
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SelectedLanguage)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a website which to begin with will have three clear sub sites:
I have a classifieds website, and inside each classified, there is a small form.
The situation is, I have a website where the users get a sub domain.
We have a website made by Django. And there is no problem when access
I have an asp.net website that uses forms authentication. There are a few things
I have a really cool website that allows people to upload images. Sometimes there
I have a website that plays mp3s in a flash player. If a user
I have a website that I've just uploaded onto the Internet. When I browse
We have a website that uses #include file command to roll info into some
I have a website that is perfectely centered aligned. The CSS code works fine.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.