ASP.NET should I use a "checkUser" function in pre_init or page_load

Go To StackoverFlow.com

0

Just wondering I have a function which checks the language of a page (multi-lingual site), and if not default language we need to redirect to default language for one section i.e.

if (Sitecore.Context.Language.Name != LanguageManager.DefaultLanguage.ToString())
{
     Sitecore.Context.SetLanguage(LanguageManager.DefaultLanguage, true);
     Response.Redirect(SourceHomeUrl(), true);
}

I am just wondering is it best to put it in pre_init i.e. do this check before anything loads and just redirect then ?

2012-04-05 17:27
by StevieB


1

If you can do it in the pre init event, it would be better to do it there, so that you can redirect the user before any additional/unnecessary loading and processing takes place vs. doing it in page_load.

2012-04-05 17:32
by Nick Rolando


0

It seems reasonable but I would also look at other alternatives to handling a multilingual application like storing the language specific text in a database or resource files

http://msdn.microsoft.com/en-us/goglobal/bb688115

2012-04-05 17:33
by Christopher Rathermel
Ads