Access to the .Tasks assembly from Application_BeginRequest()

Apr 27, 2010 at 6:45 AM

Hi,

I'm developing a web application based on WhoCanHelpMe and I'm having a problem.

I want to be able to access the MyProject.Tasks via the interfaces in MyProject.Domain from Application_BeginRequest() method in global.asax.cs. Is there a way to inject my tasks interface so I have access to it from Application_BeginRequest()? Of course I already have the access to the interface but not the implementation assembly (since there is no reference to the MyProject.Tasks assembly in MyProject.Web)

Thanks!
/Ingo

Coordinator
Apr 27, 2010 at 9:12 AM

Hi,

can I just ask what you're trying to do in Application_BeginRequest?

thanks,

Howard

Apr 27, 2010 at 3:55 PM

Hi Howard,

Thanks for replying. I want to determind which country the vistor is from (by looking this up an ip-to-country table in the database) and from that determind which language should be presented to the vistor.

If you know of a better way to accomplish this I would be delighted? It's the first time I'm developing a multilingual website.

Thanks

/Ingo

Coordinator
Apr 27, 2010 at 5:55 PM

Hi,

I know that IP address is always a little dodgy for establishing language / locale as many companies use proxies that give false readings.

Sniffing the browser is often a better solution - http://www.west-wind.com/weblog/posts/334.aspx

If not I'd probably do something Like

var localisationTask = ServiceLocator.Resolve<ILocalisationTask>()

localisationTask.GetLocaleForIpAddress(ipAddress);

etc...

 

/Howard

Apr 27, 2010 at 6:43 PM

Hi,

Ok, thanks a lot for your help! I'll go with your suggestion and determind language based on the browser language.

Thanks for sharing the link. It had it all.

/Ingo