I am considering using HttpModule for localization purposes (based on an example in this article ) - but I'm curious, is this safe?
Here is the code for reference:
public class CookieLocalizationModule : IHttpModule { public void Dispose() { } public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } void context_BeginRequest(object sender, EventArgs e) {
I got the impression that multiple threads could potentially serve the web request. Is it safe to set current / current UI cultures in an HttpModule like this, and does it respect it throughout the web request no matter how many threads are involved in serving it?
Update:
I have been using this method in production for almost a year now, so I can, of course, make sure that HttpModule is quite safe for localization.
source share