473,657 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I change an URL?

Hello,

I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />

I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />

I change the " to ' because when I was using " I got an error.

I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO

I got "OOen-USOO" which was what I was expecting.

However the image doesn't show up.

Can someone help me?

I don't know what else to do.

Thank You,
Miguel

Nov 19 '05 #1
4 1992
re:
However the image doesn't show up.
Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>

and setting Session("cultur e") to CultureInfo.Cur rentCulture.Nam e :

<%Session("cult ure") = CultureInfo.Cur rentCulture.Nam e%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("cul ture")%>/myImage.jpg' />


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl... Hello,

I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />

I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />

I change the " to ' because when I was using " I got an error.

I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO

I got "OOen-USOO" which was what I was expecting.

However the image doesn't show up.

Can someone help me?

I don't know what else to do.

Thank You,
Miguel

Nov 19 '05 #2
If you use <%= Session("cultur e") %> instead of <%# Session("cultur e") %>
you should get your desired results. <%# ... %> is for data binding. You
could also use Page.DataBind() but it may be overkill for your needs.

HTH
----------------
Dave Fancher
http://davefancher.blogspot.com

"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
Hello,

I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />

I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />

I change the " to ' because when I was using " I got an error.

I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO

I got "OOen-USOO" which was what I was expecting.

However the image doesn't show up.

Can someone help me?

I don't know what else to do.

Thank You,
Miguel

Nov 19 '05 #3
In fact, you can probably skip the session object altogether.

<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>

<img src='images/<%=CultureInfo. CurrentCulture. Name%>/myImage.jpg' />

If you are setting the culture in the globalization section of web.config,
that should work even better than setting a session("cultur e") variable.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:Oy******** ******@tk2msftn gp13.phx.gbl...
re:
However the image doesn't show up.


Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>

and setting Session("cultur e") to CultureInfo.Cur rentCulture.Nam e :

<%Session("cult ure") = CultureInfo.Cur rentCulture.Nam e%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("cul ture")%>/myImage.jpg' />


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
Hello,

I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />

I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />

I change the " to ' because when I was using " I got an error.

I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO

I got "OOen-USOO" which was what I was expecting.

However the image doesn't show up.

Can someone help me?

I don't know what else to do.

Thank You,
Miguel


Nov 19 '05 #4
Hi Juan and Dave and Everybody else,

Using <%= worked fine.

I do set culture in Web.Config.

However in my page I have a button to change language (change culture).
It is working the following way:
1. Sets default culture in web.config as "en-US" and Session("cultur e")
as that value.
2. Detects in Global.asax in Session_start if a cookie exist in client.
3. If exists changes threat culture and also Session("cultur e")

Then I use <%= Session("cultur e") %> to change URL's, database fields
and other items in my HTML page.

I have some questions about my approach:
1. Should I use threat culture in <%= ... %>?
2. Should I set threat culture in Page_Load in all pages or setting it
only in Session_Start is enough? Well, at least until the language
button is not pressed which runs a function.
3. Is there a way to change the application culture itself? Is it
better?

These are the questions I came up when building this.

I would appreciate some feedback on this.

Thank You,
Miguel

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:no******** ***@nowhere.com :
In fact, you can probably skip the session object altogether.

<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>

<img src='images/<%=CultureInfo. CurrentCulture. Name%>/myImage.jpg' />

If you are setting the culture in the globalization section of web.config,
that should work even better than setting a session("cultur e") variable.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:Oy******** ******@tk2msftn gp13.phx.gbl...
re:

However the image doesn't show up.

Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>

and setting Session("cultur e") to CultureInfo.Cur rentCulture.Nam e :

<%Session("cult ure") = CultureInfo.Cur rentCulture.Nam e%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("cul ture")%>/myImage.jpg' />


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...

Hello,

I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />

I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />

I change the " to ' because when I was using " I got an error.

I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO

I got "OOen-USOO" which was what I was expecting.

However the image doesn't show up.

Can someone help me?

I don't know what else to do.

Thank You,
Miguel



Nov 19 '05 #5

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

Similar topics

4
3887
by: J.C. Flores | last post by:
Hello all, First of all, I must state that I'm new to SQL Server, but have been a long-time software guy for quite some time. Please excuse the potential simplicity of the solution to my problem. I create a blank database (TestDB) under my server machine (SQL Server 2000 Standard)... I then create a new table (Run_Number) with only one record in it.
1
3202
by: Spike | last post by:
Hello! Im going to make a javascript for changing alot of images. But im not sure how to do it., where to start.. Ok, first.. this is the isue. I have 3 images(I call them 1a-3a). when u click on image 1a u change" image x" to image 1a when u click on image 2a u change" image x" to image 2a when u click on image 3a u change" image x" to image 3a
0
1825
by: beanweed | last post by:
BACKGROUND ---------- I have an ASP.NET application having two panels. In one panel, an XML document, transformed using xsl, is displayed. In the other panel are some controls that allow a user to change the xml. For example, each "l_item" element appears as a row in a table labelled with a "label"; so if I have <l_item id="1"> <label>blah</label> ...
5
7115
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is the printer destination for special reports such as stickers and mailing labels. The Mailing Label report is, of course, designed here for a specific printer (Mailing Label). At another site, the name could be completely different. Other than...
10
9864
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
4
4449
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I change the Clientsize does the display stay the same but the number of units required to reference a given point changes? Anyway, it appears to me that If I want to change to size of the control so that the client size is some value, I need to...
3
5005
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change data in the text boxes. Then an "update" button saves the data back to the database. What is the best way to change several properties on most of the textbox controls on the form when the "modify" button is clicked? (e.g. make them editible (and...
2
4488
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? I'm trying to figure out the best way to handle domain users to log into an .asp application tied with SQL Server 2000 on the back end since I keep reading that windows authentication is better practice to log into SQL Server. Thanks in...
11
7448
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
1
16438
by: monkey1001 | last post by:
my program is suppose to show my due change and i got it working but my change and coins are wrong how can i improve it thank you..(its supposed to be in java)
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
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
8522
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,...
1
6177
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...
1
2745
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 we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
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.