473,396 Members | 1,827 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,396 software developers and data experts.

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("culture") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("culture") %>/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("culture")) %>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 1980
re:
However the image doesn't show up.
Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Globalization" %>

and setting Session("culture") to CultureInfo.CurrentCulture.Name :

<%Session("culture") = CultureInfo.CurrentCulture.Name%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("culture")%>/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.*DELETE2SEND*com> wrote in message
news:uK**************@tk2msftngp13.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("culture") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("culture") %>/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("culture")) %>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("culture") %> instead of <%# Session("culture") %>
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.*DELETE2SEND*com> wrote in message
news:uK**************@tk2msftngp13.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("culture") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("culture") %>/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("culture")) %>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="System.Globalization" %>

<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("culture") 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**************@tk2msftngp13.phx.gbl...
re:
However the image doesn't show up.


Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Globalization" %>

and setting Session("culture") to CultureInfo.CurrentCulture.Name :

<%Session("culture") = CultureInfo.CurrentCulture.Name%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("culture")%>/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.*DELETE2SEND*com> wrote in message
news:uK**************@tk2msftngp13.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("culture") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("culture") %>/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("culture")) %>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("culture")
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("culture")

Then I use <%= Session("culture") %> 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="System.Globalization" %>

<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("culture") 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**************@tk2msftngp13.phx.gbl...
re:

However the image doesn't show up.

Try importing the globalization namespace:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Globalization" %>

and setting Session("culture") to CultureInfo.CurrentCulture.Name :

<%Session("culture") = CultureInfo.CurrentCulture.Name%>

Then, you can retrieve the image name with :
<img src='images/<%=Session("culture")%>/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.*DELETE2SEND*com> wrote in message
news:uK**************@tk2msftngp13.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("culture") Value /myImage.jpg" />

This is what I did:
<img src='images/<%# Session("culture") %>/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("culture")) %>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
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...
1
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...
0
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...
5
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...
10
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
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...
3
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...
2
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? ...
11
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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,...
0
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,...

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.