Facebook and Localization

Jan 26, 2009 at 2:53 PM
Hello developers

I'm trying to localize the content in my Facebook application. But using Global.asax to do that makes my application fail. Also tried setting the culture in HttpModule.

In Global.asax

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            CultureInfo CI;

            CI = new CultureInfo(Request.UserLanguages[0]);

            // Set the current cultures from the language
            // of the browser

            Thread.CurrentThread.CurrentUICulture = CI;
        }

In a HttpModule:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Threading;
using System.Reflection;
using System.Globalization;

namespace ModuleLibrary
{
    public class CultureModule : IHttpModule
    {
        public void Dispose()
        {
        }

        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }

        private void context_BeginRequest(object sender, EventArgs e)
        {
            CultureInfo CI;

            HttpRequest Request = ((HttpApplication)sender).Request;

            CI = new CultureInfo(Request.UserLanguages[0]);

            Thread.CurrentThread.CurrentUICulture = CI;
        }
    }
}

Facebook does not give a meaningful errormessage. Just the following:

Errors while loading page from application

Received HTTP error code 500 while loading http://www.book-frisoer.dk/?_fb_fromhash=2b4c66df2157b83551ab6f36ed9b41e8

I have a Page_PreInit and a Page_Load in the code behind my canvas page. Could it have something to do with this, because I found out that code in my Global.asax was being called twice.

Thanks in advance.