473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

One page for several languages, but different domains?

Hi everybody,

I have a plain good ol' HTML website that currently hosts several localized
versions of pages. That is, depending on the address/domain that users
enter into their browser, the respective page is being shown in the
underlying language, such as www.site.com -english or www.site.fr ->
french.
In the new ASP.Net application, all pages' textual content (text + tags)
comes from a SQL Server database. While I could create one folder for each
language plus the .aspx-pages, I wonder as to whether there isn't an easier
way of dealing with this, like re-direction or assembling a QueryStrng
(i.e. <?lang=it>) that would allow me to only create ONE page and still
keep the addresses intact.

Hence, browsing to www.site.com/page.aspx and www.site.fr/page.aspx would
both lead to the *same* page.aspx (there would only be one for all
languages) and the app would use the domain to determine the right language
to be returned.

Any insights/hints would be much appreciated!

--
Regards,
J.
Nov 20 '08 #1
4 1397
On Nov 20, 10:22*am, Jon F <inva...@invalid.comwrote:
Hi everybody,

I have a plain good ol' HTML website that currently hosts several localized
versions of pages. That is, depending on the address/domain that users
enter into their browser, the respective page is being shown in the
underlying language, such aswww.site.com-english orwww.site.fr->
french.
In the new ASP.Net application, all pages' textual content (text + tags)
comes from a SQL Server database. While I could create one folder for each
language plus the .aspx-pages, I wonder as to whether there isn't an easier
way of dealing with this, like re-direction or assembling a QueryStrng
(i.e. <?lang=it>) that would allow me to only create ONE page and still
keep the addresses intact.

Hence, browsing towww.site.com/page.aspxandwww.site.fr/page.aspxwould
both lead to the *same* page.aspx (there would only be one for all
languages) and the app would use the domain to determine the right language
to be returned.

Any insights/hints would be much appreciated!

--
Regards,
J.
Hi Jon

you can use Request.Url.Host to get the name of domain from the
current request. It returns "www.site.com", or "site.com" where you
would need to check the last segment (1st level domain) "com".

So, you can do something like this

string[] name = Request.Url.Host.ToLower().Split(".");
string test = name[name.length()-1];
string lang;

if (test == "com")
lang == "en";

if (test == "fr")
lang == "fr";

string sql = "select * from table where language code='"+lang + "'";
Nov 20 '08 #2
On Thu, 20 Nov 2008 01:47:20 -0800 (PST), Alexey Smirnov wrote:
Greetings Alexey,

Alexey Smirnov wrote:
you can use Request.Url.Host to get the name of domain from the
current request. It returns "www.site.com", or "site.com" where you
would need to check the last segment (1st level domain) "com".

So, you can do something like this
(...)
drat! I fumbled around with something almost identical in the beginning!
Back then thought this couldn't work due to the paths/mappings: the old
HTTP-app simply maps the domains to different directories on the server
where, for each language, the respective htm-files are located.
However, I didn't even think of the possibility to simply use the
webspace's provider mapping so that all domains' requests are simply being
sent to the single solution directory. That should actually work!

The only drawback with this solution is that I need some additional stuff
while being on localhost, but with a little additional work that should be
feasible.

Thanks for the pointer, Alexey!

--
Regards,
J.
Nov 20 '08 #3
Hi again,
The only drawback with this solution is that I need some additional stuff
while being on localhost, but with a little additional work that should be
feasible.
done. I have added UrlMappings that will handle .../[code]/... paths and
translate these into a QueryString so that i.e. "www.Website.com/it/"
becomes "www.Website.com/default.aspx?lang=it". The QueryString is then
transformed into a language code. Hence, using localhost, I can sort of
simulate the domain name and "navigate" to any given language.

--
Regards,
J.
Nov 20 '08 #4
On Nov 20, 4:59*pm, Jon F <inva...@invalid.comwrote:
Hi again,
The only drawback with this solution is that I need some additional stuff
while being on localhost, but with a little additional work that shouldbe
feasible.

done. I have added UrlMappings that will handle .../[code]/... paths and
translate these into a QueryString so that i.e. "www.Website.com/it/"
becomes "www.Website.com/default.aspx?lang=it". The QueryString is then
transformed into a language code. Hence, using localhost, I can sort of
simulate the domain name and "navigate" to any given language.

--
Regards,
J.
Sounds great.

There are a couple of other solutions available that can help you as
well. One of them is HTTP module for URL rewriting, another one could
be done if you have access to IIS - you can make different virtual
directories, e.g. /de /en /fr pointed to the same (root) directory of
your website and use Request.Url to get a "language code" from it.
Nov 20 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Julia | last post by:
Hi, I have the following scenario Page A.asp call page B.asp Page B.asp need to load page C.asp make some changes and return the result to IE when A.asp is first running IIS create a...
11
by: Eric Osman | last post by:
Let's say I want to filter the contents of a target web page, and present a simpler page on the screen. For example, let's say a target web page is full of links, text, images, forms, etc. and...
1
by: Varsha | last post by:
Hi, How can I display characters from different character sets on the same HTML page? How to simultaneously display multiple languages on the same page. I am using div tag to display source and...
32
by: sandy | last post by:
I have a hobby website at: http://www.montana-riverboats.com which also resolves as: http://montana-riverboats.com ...without the www. One address has a Google page rank of three. The other...
1
by: Matt | last post by:
Hi I hope someone out there can help me with this.... I have purchased a hosting account from 1and1.co.uk, and have set up a number of domains. Each of these domains points to a different...
28
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
42
by: smerf | last post by:
Using javascript, is there a way to trap an external page inside a frame? I've seen scripts to break out of frames, but nothing to keep a page trapped in a frame.
11
by: Bocah Sableng | last post by:
Hi, I'm new member of this group. I had added new virtual host at my intranet server. The new virtual host configuration on httpd.conf is similar with the old one. At the new virtual host, the...
5
by: rahullko05 | last post by:
Hi, I am developing forum website as my final year project. I am having problem in generating different URLs but keeping the same page.. Scenario: I am showing threads for different languages in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.