473,480 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Master Pages and Absolute Image URI's in HTML

Hi Guys

I have an ASP.NET project with a rough layout as shown below
Default.aspx
Login.aspx
Site.master
web.config
/IMAGES/Image1.jpg
/Image2.jpg
/Image3.jpg ...
/Secure/SecurePage1.aspx
/SecurePage2.aspx
/SecurePage3.aspx
/web.config
Loads of stuff left out, but that is the gist of it. All pages use the
Master Page, There are password protected pages held within the /Secure
folder.

Problem:

My master page uses HTML that includes bith <IMGtags and Java Script
that manipulates the images in the /Images folder.

I cannot get the SRC attrbiute of the <IMGtag to give me an image
that will display for both the "Default.aspx" and "SecurePage1.aspx".

My <IMGtags look something like (Code from memory, not cut/paste)

<IMG src="/Images/image1.jpg" ... />

It seems that when I use the URI specification

<IMG src="Images/image1.jpg" ... />

The image is displayed in the Default.aspx only. But if I change it to
<IMG src="/Images/image1.jpg" ... />

the image is not displayed in the Default.aspx OR any of the pages in
the Secure folder.

I read that putting the "/" at the start will set the URI to be
relative to the root of the site, but I just cannot seem to get this to
work.

Could anyone point me in the direction of what may be my problem please
?

kind regards

Mike.

p.s.

There are NO ASP.NET Image Server side controls, it is all basic HTML
as spat out from Photoshop/GoLive. I would like this to remain if
possible, with just a minor URI change for the images.

Nov 30 '06 #1
3 4029
Hey, try this:

<IMG src="<%= Page.ResolveUrl("~")%>/Images/image1.jpg" ... />

On 30 Nov 2006 00:52:06 -0800, Ad**********@googlemail.com wrote:
>?Hi Guys

I have an ASP.NET project with a rough layout as shown below
Default.aspx
Login.aspx
Site.master
web.config
/IMAGES/Image1.jpg
/Image2.jpg
/Image3.jpg ...
/Secure/SecurePage1.aspx
/SecurePage2.aspx
/SecurePage3.aspx
/web.config
Loads of stuff left out, but that is the gist of it. All pages use the
Master Page, There are password protected pages held within the /Secure
folder.

Problem:

My master page uses HTML that includes bith <IMGtags and Java Script
that manipulates the images in the /Images folder.

I cannot get the SRC attrbiute of the <IMGtag to give me an image
that will display for both the "Default.aspx" and "SecurePage1.aspx".

My <IMGtags look something like (Code from memory, not cut/paste)

<IMG src="/Images/image1.jpg" ... />

It seems that when I use the URI specification

<IMG src="Images/image1.jpg" ... />

The image is displayed in the Default.aspx only. But if I change it to
<IMG src="/Images/image1.jpg" ... />

the image is not displayed in the Default.aspx OR any of the pages in
the Secure folder.

I read that putting the "/" at the start will set the URI to be
relative to the root of the site, but I just cannot seem to get this to
work.

Could anyone point me in the direction of what may be my problem please
?

kind regards

Mike.

p.s.

There are NO ASP.NET Image Server side controls, it is all basic HTML
as spat out from Photoshop/GoLive. I would like this to remain if
possible, with just a minor URI change for the images.
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 30 '06 #2
Thanks mate,

that works OK for the <IMGTags, but I also have Javascript
manipulating the images and the <% construct does not work in there.

Mike
Rad [Visual C# MVP] wrote:
Hey, try this:

<IMG src="<%= Page.ResolveUrl("~")%>/Images/image1.jpg" ... />

On 30 Nov 2006 00:52:06 -0800, Ad**********@googlemail.com wrote:
?Hi Guys

I have an ASP.NET project with a rough layout as shown below
Default.aspx
Login.aspx
Site.master
web.config
/IMAGES/Image1.jpg
/Image2.jpg
/Image3.jpg ...
/Secure/SecurePage1.aspx
/SecurePage2.aspx
/SecurePage3.aspx
/web.config
Loads of stuff left out, but that is the gist of it. All pages use the
Master Page, There are password protected pages held within the /Secure
folder.

Problem:

My master page uses HTML that includes bith <IMGtags and Java Script
that manipulates the images in the /Images folder.

I cannot get the SRC attrbiute of the <IMGtag to give me an image
that will display for both the "Default.aspx" and "SecurePage1.aspx".

My <IMGtags look something like (Code from memory, not cut/paste)

<IMG src="/Images/image1.jpg" ... />

It seems that when I use the URI specification

<IMG src="Images/image1.jpg" ... />

The image is displayed in the Default.aspx only. But if I change it to
<IMG src="/Images/image1.jpg" ... />

the image is not displayed in the Default.aspx OR any of the pages in
the Secure folder.

I read that putting the "/" at the start will set the URI to be
relative to the root of the site, but I just cannot seem to get this to
work.

Could anyone point me in the direction of what may be my problem please
?

kind regards

Mike.

p.s.

There are NO ASP.NET Image Server side controls, it is all basic HTML
as spat out from Photoshop/GoLive. I would like this to remain if
possible, with just a minor URI change for the images.
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 30 '06 #3
Maybe if you could post an example of the javascript....

On 30 Nov 2006 12:35:43 -0800, Ad**********@googlemail.com wrote:
>Thanks mate,

that works OK for the <IMGTags, but I also have Javascript
manipulating the images and the <% construct does not work in there.

Mike
Rad [Visual C# MVP] wrote:
>Hey, try this:

<IMG src="<%= Page.ResolveUrl("~")%>/Images/image1.jpg" ... />

On 30 Nov 2006 00:52:06 -0800, Ad**********@googlemail.com wrote:
>?Hi Guys

I have an ASP.NET project with a rough layout as shown below
Default.aspx
Login.aspx
Site.master
web.config
/IMAGES/Image1.jpg
/Image2.jpg
/Image3.jpg ...
/Secure/SecurePage1.aspx
/SecurePage2.aspx
/SecurePage3.aspx
/web.config
Loads of stuff left out, but that is the gist of it. All pages use the
Master Page, There are password protected pages held within the /Secure
folder.

Problem:

My master page uses HTML that includes bith <IMGtags and Java Script
that manipulates the images in the /Images folder.

I cannot get the SRC attrbiute of the <IMGtag to give me an image
that will display for both the "Default.aspx" and "SecurePage1.aspx".

My <IMGtags look something like (Code from memory, not cut/paste)

<IMG src="/Images/image1.jpg" ... />

It seems that when I use the URI specification

<IMG src="Images/image1.jpg" ... />

The image is displayed in the Default.aspx only. But if I change it to
<IMG src="/Images/image1.jpg" ... />

the image is not displayed in the Default.aspx OR any of the pages in
the Secure folder.

I read that putting the "/" at the start will set the URI to be
relative to the root of the site, but I just cannot seem to get this to
work.

Could anyone point me in the direction of what may be my problem please
?

kind regards

Mike.

p.s.

There are NO ASP.NET Image Server side controls, it is all basic HTML
as spat out from Photoshop/GoLive. I would like this to remain if
possible, with just a minor URI change for the images.
--

Bits.Bytes.
http://bytes.thinkersroom.com
--

Bits.Bytes.
http://bytes.thinkersroom.com
Dec 1 '06 #4

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

Similar topics

0
3711
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank...
5
1706
by: Nalaka | last post by:
Hi, When an image is put on a master page... the url to th eimage is set relatve to the master page. (at least don't know how top set an absolute URL to image) But the when a content page is...
1
2207
by: anony | last post by:
Hello, I'm converting a 1.1 app to 2.0 and decided to try out master pages. My menu system consists of images with onmouseover/out events to highlight selected menu items, and to display...
2
6903
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
6
1863
by: Ben Fidge | last post by:
Hi I've just created a new Master Page for my site and it uses the native Menu control. Strange behaviour is happening on page that use the master page. For some reason, the menu controls...
8
6661
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
16
1884
by: IfThenElse | last post by:
Hi, I have a web page in a subfolder that inherits a Master page at the root. the webpage in the subfolder can not see the Master page. This is what I have in my ...
5
1501
by: =?Utf-8?B?QW50?= | last post by:
Hi, I'm a newbie to the Master page. When i drag an image directly onto the master page from say my image folder, it is reflected in all pages which use it, however, if I drag a table, layout,...
1
1312
by: raghulvarma | last post by:
I have created a master page <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
0
7055
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
6920
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
6763
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
5367
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,...
0
4503
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1313
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
574
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
210
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.