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

  • Home
  • SEARCH
  • 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 704865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:59:22+00:00 2026-05-14T03:59:22+00:00

i have multilingual asp.net site. there is a masterpage and default.aspx. I put two

  • 0

i have multilingual asp.net site.
there is a masterpage and default.aspx.

I put two buttons in masterpage – one to click when i want to change the language to english, second for polish. Of course, I want to change the language after click on these buttons (and all changes should appear automatically on the page)

here is a code for both:

protected void EnglishButton_Click(object sender, ImageClickEventArgs e)
{
    string selectedLanguage = "en-US";
    //Sets the cookie that is to be used by InitializeCulture() in content page
    HttpCookie cookie = new HttpCookie("CultureInfo");
    cookie.Value = selectedLanguage;
    Response.Cookies.Add(cookie);
    Server.Transfer(Request.Path);
}

protected void PolishButton_Click(object sender, ImageClickEventArgs e)
{
    string selectedLanguage = "pl-PL";
    //Sets the cookie that is to be used by InitializeCulture() in content page
    HttpCookie cookie = new HttpCookie("CultureInfo");
    cookie.Value = selectedLanguage;
    Response.Cookies.Add(cookie);
    Server.Transfer(Request.Path);
}

in default.aspx.cs i have InitializeCulture():

protected override void InitializeCulture()
{
    HttpCookie cookie = Request.Cookies["CultureInfo"];

    // if there is some value in cookie
    if (cookie != null && cookie.Value != null)
    {
        Thread.CurrentThread.CurrentCulture =
            CultureInfo.CreateSpecificCulture(cookie.Value);
        Thread.CurrentThread.CurrentUICulture = new
            CultureInfo(cookie.Value);
    }
    else // if none value has been sent by cookie, set default language
    {
        Thread.CurrentThread.CurrentCulture =
            CultureInfo.CreateSpecificCulture("pl-PL");
        Thread.CurrentThread.CurrentUICulture = new
            CultureInfo("pl-PL");
    }

    base.InitializeCulture();
}

i added resource files and in one label i show actual culture:

Welcome.Text = “Culture: ” + System.Globalization.CultureInfo.CurrentCulture.ToString();

the problem is that when i run this app and click e.g. english button (default language is polish), there is no effect. if i click it second time or press F5, the changes are applied and in the label the Culture is displayed as en-US.
Tsame happens if i want to change language back to polish (it works after second click (or one click and refresh)).

What am i doing wrong?

  • 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-14T03:59:22+00:00Added an answer on May 14, 2026 at 3:59 am

    I suspect the problem might be in your use of Server.Transfer in your button click event. Have you tried using Response.Redirect instead?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multilingual ASP.NET site; one of the languages is Arabic (ar-SA). To
I have developed a multi-lingual site in ASP.NET, which detects the user's system culture,
I am implementing an multilingual web site using ASP.Net. The languages are English,French and
Im working on a multilingual site using asp.net mvc, and im wondering how search
I've built a multilingual ASP.NET web app and no problem . I'm trying to
I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I am developing my first multilingual C# site and everything is going ok except

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.