473,811 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ 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 1582
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.Qu eryString["lang"];
if (lang==null) lang="en";
response.redire ct("www.thedoma inIregistered.c om/" + lang + "/thepage.aspx
");

Or instead response.redire ct, 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.vod atel.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.Qu eryString["lang"];
if (lang==null) lang="en";
response.redire ct("www.thedoma inIregistered.c om/" + lang + "/thepage.aspx
");

Or instead response.redire ct, 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.QuerySt ring["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.vod atel.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.QuerySt ring["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.Rewrite Path("/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.comw rote in message
news:eh******** ******@TK2MSFTN GP05.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.vod atel.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.QueryS tring["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
"ThunderMus ic" <No************ *************@N oSpAm.comwrote in message
news:Op******** ******@TK2MSFTN GP03.phx.gbl...
ok, thanks...

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

context.Rewrite Path("/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.comw rote in message
news:eh******** ******@TK2MSFTN GP05.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.vo datel.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.Query String["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
4938
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 displayed error comes ..this error does'nt comes on a particular page .please help me to solve this problem..
1
3257
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 of my link file that should load next to the menu on the same page. And Thank You in advance. Here is my menu applet: <html>
0
1899
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 have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
2
3382
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 for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
3
2942
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 bloating the size of my page, especially in my menu. I am aware the "default" language of the page is the first defined script, but I can not guarantee javascript will always be defined first. Is there a way to wrap a block of html to have a...
2
1657
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 instance, you can have Language="vb" CodeBehind="classA.cs" In VS 2005, the CodeBehind attribute seems to have been replaced with
0
1721
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 please point me in the right direction to bind a theme to the treeview? The 'theme' tag is on the <%@ page %> directive... however neither my master page or ASCX files use this. They use <%Master%> and
6
4906
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 the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
2
1458
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
3292
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 "Searching..." page then, refreshes and displays the table I want. I have code that grabs data from the page using cURL but when I look at the data it contains the "Searching..." page and not the table that I want. below is the code i have so far....Thanks...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10403
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.