Home > Uncategorized > ExecuteCore not called in ASP.NET MVC 4

ExecuteCore not called in ASP.NET MVC 4

If you want a function to be called before every page load in an MVC asp.net web application, then you could of course call that function from every action, or you can override the ExecuteCore method.

But no… It never gets called, what can you do?, well, I discovered on StackOverflow, that if you also override DisableAsyncSupport and return true, then the ExecuteCore method gets called



protected override void ExecuteCore()
// Modify current thread’s cultures
var strCulture = CurrentLocale();
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(strCulture);
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;


/// <summary>
/// Ensures that ExecuteCore() is called.
/// </summary>
protected override bool DisableAsyncSupport
get { return true; }

This is how, I’ve created two code-identical sites, www.freesms.cat and www.kostenfreiesms.com with different resource files to handle two different locales

Categories: Uncategorized
  1. Patrik Lilja
    February 27, 2018 at 2:41 pm

    Thanks for the leed!
    If you got problems with this in newer MVC take a look at

  2. February 27, 2018 at 2:43 pm

    Thanks for the leed,
    If you are having trouble in newer MVC take a look att

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: