473,473 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Page language

Hi,
I'm currently developping a web site (not a web application) with asp.net
and would like to use the localization functionalities to avoid doing my
pages twice (and maybe eventually, 3 times). But I would also like the user
to have urls like www.thedomainIregistered.com/en/thepage.aspx or
www.thedomainIregistered.com/fr/thepage.aspx that would lead to the same
aspx (even if the url in the url bar stays the same) in the end but would
set the language to 'en' or 'fr' depending on the url.

Is this possible? if so, how can I do it? I mean, I thought of doing it
with a custum handler that would set the culture and then redirect, but
after the redirect, we lose the 'en' or 'fr'... I would like to keep it...

Thanks a lot

ThunderMusic
May 8 '07 #1
6 1563
to have urls like www.thedomainIregistered.com/en/thepage.aspx or
www.thedomainIregistered.com/fr/thepage.aspx that would lead to the same
aspx (even if the url in the url bar stays the same) in the end but would
set the language to 'en' or 'fr' depending on the url.

Is this possible? if so, how can I do it? I mean, I thought of doing it
with a custum handler that would set the culture and then redirect, but
after the redirect, we lose the 'en' or 'fr'... I would like to keep
it...
You can put this:
string lang=Request.QueryString["lang"];
if (lang==null) lang="en";
response.redirect("www.thedomainIregistered.com/" + lang + "/thepage.aspx
");

Or instead response.redirect, you can put this code in aspx file (not
aspx.cs) and make a href link at the same way!
May 8 '07 #2
thanks for the answer... but it's not quite what I was searching for...
maybe I explained it wrong... ;)

What I want is the user to type
http://www.thedomainIregistered.com/en/thepage.aspx and the server knowing
that this page must be in english (so set the culture) and "redirect" the
user to http://www.thedomainIregistered/thepage.aspx and let the user think
it's on http://www.thedomainIregistered.com/en/thepage.aspx (by letting this
url in his url bar) What I need is some kind of stealth redirect. You may
actually ask me why I want to do this... it's because of the bookmarks
and/or indexing of sites in let's say, google... ;)

So I want it to stay http://www.thedomainIregistered.com/en/thepage.aspx in
the user URL bar, but I want my server to know it's actually
http://www.thedomainIregistered/thepage.aspx with the culture set to
english. I can make the other way around really easily (take the one without
a language and redirect to the one with the language), but that's not what
I'm trying to achieve...

Thanks a lot

ThunderMusic

"Tony" <To*****@gmail.comwrote in message
news:f1**********@magcargo.vodatel.hr...
>to have urls like www.thedomainIregistered.com/en/thepage.aspx or
www.thedomainIregistered.com/fr/thepage.aspx that would lead to the same
aspx (even if the url in the url bar stays the same) in the end but would
set the language to 'en' or 'fr' depending on the url.

Is this possible? if so, how can I do it? I mean, I thought of doing it
with a custum handler that would set the culture and then redirect, but
after the redirect, we lose the 'en' or 'fr'... I would like to keep
it...

You can put this:
string lang=Request.QueryString["lang"];
if (lang==null) lang="en";
response.redirect("www.thedomainIregistered.com/" + lang + "/thepage.aspx
");

Or instead response.redirect, you can put this code in aspx file (not
aspx.cs) and make a href link at the same way!

May 8 '07 #3
So I want it to stay http://www.thedomainIregistered.com/en/thepage.aspx
in the user URL bar, but I want my server to know it's actually
http://www.thedomainIregistered/thepage.aspx with the culture set to
english. I can make the other way around really easily (take the one
without a language and redirect to the one with the language), but that's
not what
You must use query strings (like www.mysite.com/mypage.aspx?lang=EN) and
then EN is your variable in query string - you can get it with
Request.QueryString["lang"]. After that you need to "rewrite url". I know
that it is possible, but I can't understand how. So maybe other programmers
from this newsgroup can explain how to use "URL Rewriting".
May 8 '07 #4
Yes, you are correct. Use URL ReWriting. (search google for hundreds of
examples).

You would enter a link like www.site.com/en/page.aspx and your url rewrite
would actually go to www.site.com/page.aspx?lang=en. Your page.aspx would
pick up the lang value and render the correct content. The page in the
address bar would continue to show www.site.com/en/page.aspx (until you
click a button or linkbutton, as your form renders to the ?lang=en page.)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Tony" <To*****@gmail.comwrote in message
news:f1**********@magcargo.vodatel.hr...
>So I want it to stay http://www.thedomainIregistered.com/en/thepage.aspx
in the user URL bar, but I want my server to know it's actually
http://www.thedomainIregistered/thepage.aspx with the culture set to
english. I can make the other way around really easily (take the one
without a language and redirect to the one with the language), but that's
not what

You must use query strings (like www.mysite.com/mypage.aspx?lang=EN) and
then EN is your variable in query string - you can get it with
Request.QueryString["lang"]. After that you need to "rewrite url". I know
that it is possible, but I can't understand how. So maybe other
programmers from this newsgroup can explain how to use "URL Rewriting".

May 8 '07 #5
ok, thanks...

I've made a http custom handler and in the ProcessRequest method, I insert
the following line :

context.RewritePath("/Default.aspx", false);

Actually, I tried setting the boolean flag to true or false without any
change in behavior but for now, no matter where I "redirect" (rewrite path)
to, I get an empty page with only this content in the source :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

Does anyone have an idea why?

Thanks for your help

ThunderMusic

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:eh**************@TK2MSFTNGP05.phx.gbl...
Yes, you are correct. Use URL ReWriting. (search google for hundreds of
examples).

You would enter a link like www.site.com/en/page.aspx and your url rewrite
would actually go to www.site.com/page.aspx?lang=en. Your page.aspx would
pick up the lang value and render the correct content. The page in the
address bar would continue to show www.site.com/en/page.aspx (until you
click a button or linkbutton, as your form renders to the ?lang=en page.)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Tony" <To*****@gmail.comwrote in message
news:f1**********@magcargo.vodatel.hr...
>>So I want it to stay http://www.thedomainIregistered.com/en/thepage.aspx
in the user URL bar, but I want my server to know it's actually
http://www.thedomainIregistered/thepage.aspx with the culture set to
english. I can make the other way around really easily (take the one
without a language and redirect to the one with the language), but
that's not what

You must use query strings (like www.mysite.com/mypage.aspx?lang=EN) and
then EN is your variable in query string - you can get it with
Request.QueryString["lang"]. After that you need to "rewrite url". I know
that it is possible, but I can't understand how. So maybe other
programmers from this newsgroup can explain how to use "URL Rewriting".


May 8 '07 #6
Ok, I find myself having a lot of troubles with URL Rewriting and I've seen
on the net that in some situation indexers have difficulty indexing sites
because of some flaws in the url rewriting mecanism...

Does anybody have a solution to my problem? I mean, I want to be able to
localize my web site without having to dupplicate all the pages in 2-3 (fr,
en, sp(optional)) directories and so the indexers can index the right
content (in the right language) and people can bookmark the page in the
right language too. Is it something possible? I'd like to avoid dupplicating
pages because it could mean a pain in the you know what to maintain...
imagine a bug in one would have to be corrected in 3 places instead of
one...

Thanks

ThunderMusic
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Op**************@TK2MSFTNGP03.phx.gbl...
ok, thanks...

I've made a http custom handler and in the ProcessRequest method, I insert
the following line :

context.RewritePath("/Default.aspx", false);

Actually, I tried setting the boolean flag to true or false without any
change in behavior but for now, no matter where I "redirect" (rewrite
path) to, I get an empty page with only this content in the source :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

Does anyone have an idea why?

Thanks for your help

ThunderMusic

"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:eh**************@TK2MSFTNGP05.phx.gbl...
>Yes, you are correct. Use URL ReWriting. (search google for hundreds of
examples).

You would enter a link like www.site.com/en/page.aspx and your url
rewrite would actually go to www.site.com/page.aspx?lang=en. Your
page.aspx would pick up the lang value and render the correct content.
The page in the address bar would continue to show
www.site.com/en/page.aspx (until you click a button or linkbutton, as
your form renders to the ?lang=en page.)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Tony" <To*****@gmail.comwrote in message
news:f1**********@magcargo.vodatel.hr...
>>>So I want it to stay
http://www.thedomainIregistered.com/en/thepage.aspx in the user URL
bar, but I want my server to know it's actually
http://www.thedomainIregistered/thepage.aspx with the culture set to
english. I can make the other way around really easily (take the one
without a language and redirect to the one with the language), but
that's not what

You must use query strings (like www.mysite.com/mypage.aspx?lang=EN) and
then EN is your variable in query string - you can get it with
Request.QueryString["lang"]. After that you need to "rewrite url". I
know that it is possible, but I can't understand how. So maybe other
programmers from this newsgroup can explain how to use "URL Rewriting".



May 10 '07 #7

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

Similar topics

5
by: rathnesh | last post by:
when using a web application which includes taking an asp page then going to another asp page and coming back to first page ...some times connection to iis gets terminated and page canot be...
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
3
by: William F. Robertson, Jr. | last post by:
My problem is I routinely use both vbscript and javascript (yes, that is a problem in itself) on the same webpage. I feel placing the "javscript:" or "vbscript:" on all my client side events is...
2
by: rjack | last post by:
I'm using VS 2005 Beta 2. In VS 2003, the Page directive in an aspx page has Language and CodeBehind attributes. You can have the language be different than the code behind file language. For...
0
by: damiensawyer | last post by:
Hello all, I'm very new to all of this. I have a theme and a skin (the standard ones). I have a standard master page which is holding a custom ascx which has a treeview in it. Can someone...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: shapper | last post by:
Hello, I have 2 pages: Page1.aspx and Page2.aspx. The two pages have common design parts but also not common design parts. Is it possible to create something like this: MasterPageA |
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.