language detection for redirect to interfaces

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
1/26/2010 1:00:41 PM
Gravatar
Total Posts 98

language detection for redirect to interfaces

Hi Joe,

  How can i force redirection on my website to language set in browser interface on session start

I have 4 interfaces :EN, FR, DE, SP

/If browser language is french i want to redirect on http://localhost/fr directly

or if browser lang is english to http://localhost/en

I try to modify Session_start event from glabal.asax.cs but not work properly

Could you help me ?

Thank you , Valik

1/27/2010 3:43:05 AM
Gravatar
Total Posts 98

Re: language detection for redirect to interfaces

Anyone?

1/28/2010 2:00:35 PM
Gravatar
Total Posts 18439

Re: language detection for redirect to interfaces

Hi Valik,

First, you should not modify mojoportal code.

Second, I think it is a bad idea to make assumptions based on the browser language setting. Maybe my browser is set to French but I still want to read your English site and you won't let me?

I think it would be better to make a dropdown inside a user control that you can put in your layout.master file. The user can choose the language and you make the dropdown do autopostback, on pstback you set a cookie with the user preference and then redirect to the Request.RawUrl to get out of postback.

To redirect the user based on the cookie, you could implement a custom HttpModule which can be plugged in from Web.config and has the same events as Global.asax.cs

In Application_BeginRequest event in your custom HttpModule you can detect the cookie and redirect based on the cookie value.

Hope it helps,

Joe

1/29/2010 6:57:17 AM
Gravatar
Total Posts 98

Re: language detection for redirect to interfaces

Hi Joe,

I already have in layout.master page this dropdownlist with interfaces

I need detect user lang and  redirect only when session start

Next the user can switch between interfaces

1/29/2010 1:35:53 PM
Gravatar
Total Posts 18439

Re: language detection for redirect to interfaces

I'm not sure if Session begin event is a safe place to do a redirect, sounds kind of dodgy to me, but you can handle that event in a custom HttpModule without touching global.asax.cs

Hope it helps,

Joe

2/1/2010 4:17:49 AM
Gravatar
Total Posts 98

Re: language detection for redirect to interfaces

Could you describe how i can work with httpModule?

you have a link to documentation?

Thank you

2/2/2010 12:35:55 PM
Gravatar
Total Posts 18439

Re: language detection for redirect to interfaces

Let me google that for you ;-)

http://www.google.com/#hl=en&q=C%23+custom+httpmodule&aq=f&aqi=&oq=&fp=435311d5ec9ae78f

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.