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 3877638
In Process

The Archive Base Latest Questions

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

Let me give you some background on my scenario. I got a multi language

  • 0

Let me give you some background on my scenario. I got a multi language site and my cultures are stored in database and got a property that is public bool Active { get; set; }

  1. If you come to my site with lets say a Russian culture on your browser, that is not supported on my site so i need to set the culture to “se” (or whatever).

  2. If you come to my site with a supported culture but its not Active i need to set it to a default one “se” (or whatever).

Now I can do this check easy in my override IHttpHandler GetHttpHandler method. The thing is I dont want to make the call to the database everytime the site makes any call on the site. My thought is that I do a session[“firstVisit”] to reduce that check but I kinda don’t know how i should go about to that, because my scenario it say that
not set to an instance of an object on the session[“firstVisit”] line, so my question is how do I handle this? And what other options I got to go about this?

my thought is something like this

protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext)
        {            
            String culture = requestContext.RouteData.Values["culture"].ToString();

            if (HttpContext.Current.Session["firstVisit"].ToString() == string.Empty)
            {
                //do the check
            }

            var ci = new CultureInfo(culture);
            Thread.CurrentThread.CurrentUICulture = ci;
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
            return base.GetHttpHandler(requestContext);
        }

EDIT

Doh why did I not think of that, I ended up just doing a check in the protected void Application_Start() to avoid sessions

  • 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-19T22:31:15+00:00Added an answer on May 19, 2026 at 10:31 pm

    Use global.asax.cs:

    protected void Session_Start( object sender, EventArgs e )
    

    This method is called when the session is first created. You can do the check then, stuff your language info in the session and have it for as long as the session is live through the user’s interaction with your site.

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

Sidebar

Related Questions

Possible Duplicate: Show more digits in PHP Let me give some background information about
-Let me give some background first- My assignment is to take a given senario
Let me give some background before I ask my question. I’m at a shop
Might be complicated, so let me give you some background: I have a spreadsheet
I've created a bunch of projects in Eclipse 3.7.2. Let's give some of them
Ok, the question might not be crystal clear. Let me give some details: Let's
Let's say that I have a SQLite database that I create in a separate
OK, apologies for the verbose title. Let me give the background in a bit
Let me give some code so you can see what I'm doing with the
Let me give you some examples: Firefox 13: Chrome (latest): As you can see,

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.