I’m developing bilingual ASP.NET Application and I want to know hat is the best way to store UICulture and Culture values all over the application?
- Cookies.
- Session.
- QueryString.
- Or something else.
Update:
I want to make the same ASPX form to be bilingual pages, what I’ve got an answers till now is to make a separate page and make it accessible by sub-domain, what I’m really doing now is using Session, but i want to now what is the best practice to user Resource file to make the page bilingual without creating another copy of it.
As often, it depends on your particular use case.
Most often however you’d probably want to have a different URL for each page and language in order to have it indexed properly by search engines. For example URL’s like:
I prefer the first 2 options.
Optionally, you could redirect the user based on their browser language when they first arrive on your site (but please make sure that the user still can browse the other languages).
Update: This doesn’t mean you’ll have to make as many versions of your site as you have languages.
If you have a subdomain for each language:
InitializeCulturemethod (you may use a base class for all pages in order to keep it DRY)InitializeCulturemethodIf you decide not to use subdomains but include the culture name in your URL, you may use URL-rewriting to point to the same page from each URL.
Some code to get you started: