473,606 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

master pages and image URL

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 shown, all images (inclding masterpage) are
resoved relative to the content page location.

get get around this I copy all master page images to the sub folders
too......

this happens with the .ascx (user controls) too....

is there another soulution to setting up these image urls so that I dont
have to duplicate it.
thanks in advance.
Nalaka
Dec 19 '05 #1
5 1714
Have you tried giving the image url in format such as

"~/images/image.gif"
e.g tilde at start of the path. ~ refers to the root of the web application

For longer explanation, please see:
http://www.aspnetpro.com/newslettera...200311kd_l.asp

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Nalaka" <na******@nospa m.nospam> wrote in message
news:uK******** *****@TK2MSFTNG P15.phx.gbl...
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 shown, all images (inclding masterpage) are
resoved relative to the content page location.

get get around this I copy all master page images to the sub folders
too......

this happens with the .ascx (user controls) too....

is there another soulution to setting up these image urls so that I dont
have to duplicate it.
thanks in advance.
Nalaka

Dec 19 '05 #2
Thanks.. will try

"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:ua******** ******@tk2msftn gp13.phx.gbl...
Have you tried giving the image url in format such as

"~/images/image.gif"
e.g tilde at start of the path. ~ refers to the root of the web
application

For longer explanation, please see:
http://www.aspnetpro.com/newslettera...200311kd_l.asp

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Nalaka" <na******@nospa m.nospam> wrote in message
news:uK******** *****@TK2MSFTNG P15.phx.gbl...
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 shown, all images (inclding masterpage)
are resoved relative to the content page location.

get get around this I copy all master page images to the sub folders
too......

this happens with the .ascx (user controls) too....

is there another soulution to setting up these image urls so that I dont
have to duplicate it.
thanks in advance.
Nalaka


Dec 19 '05 #3
Thanks for Teemu's good suggestion.

Hi Nalaka,

As Teemu has mentioned , the "~/...." path point to the ASP.NET's
application root. So if you're using asp.net server control , we can always
use this style path since it is easy to locate resource.... And for some
cases that we will embeded static html element that'll point to some
resources, we may need to use static path , such as /.../..... which
start from website root (not web app root...) or just reletive path.....

In addition, we can also programmaticall y embeded asp.net applicaiton root
path in html like:

<img src='<%= ResolveUrl("~/Images/titlebar.gif") %>' />

Hope also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Nalaka" <na******@nospa m.nospam>
| References: <uK************ *@TK2MSFTNGP15. phx.gbl>
<ua************ **@tk2msftngp13 .phx.gbl>
| Subject: Re: master pages and image URL
| Date: Mon, 19 Dec 2005 11:20:28 -0800
| Lines: 47
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#0************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc. ca 199.60.181.9
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3657 69
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Thanks.. will try
|
| "Teemu Keiski" <jo****@aspalli ance.com> wrote in message
| news:ua******** ******@tk2msftn gp13.phx.gbl...
| > Have you tried giving the image url in format such as
| >
| > "~/images/image.gif"
| > e.g tilde at start of the path. ~ refers to the root of the web
| > application
| >
| > For longer explanation, please see:
| >
http://www.aspnetpro.com/newslettera..._l/asp200311kd
_l.asp
| >
| > --
| > Teemu Keiski
| > ASP.NET MVP, AspInsider
| > Finland, EU
| > http://blogs.aspadvice.com/joteke
| >
| >
| > "Nalaka" <na******@nospa m.nospam> wrote in message
| > news:uK******** *****@TK2MSFTNG P15.phx.gbl...
| >> 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 shown, all images (inclding masterpage)
| >> are resoved relative to the content page location.
| >>
| >> get get around this I copy all master page images to the sub folders
| >> too......
| >>
| >> this happens with the .ascx (user controls) too....
| >>
| >> is there another soulution to setting up these image urls so that I
dont
| >> have to duplicate it.
| >>
| >>
| >> thanks in advance.
| >> Nalaka
| >>
| >>
| >
| >
|
|
|

Dec 20 '05 #4
thanks....
let me try...... <img src='<%= ResolveUrl("~/Images/titlebar.gif") %>' />
imageUrl did not like "~/xxx" directly.

Nalaka

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:yn******** ********@TK2MSF TNGXA02.phx.gbl ...
Thanks for Teemu's good suggestion.

Hi Nalaka,

As Teemu has mentioned , the "~/...." path point to the ASP.NET's
application root. So if you're using asp.net server control , we can
always
use this style path since it is easy to locate resource.... And for some
cases that we will embeded static html element that'll point to some
resources, we may need to use static path , such as /.../..... which
start from website root (not web app root...) or just reletive path.....

In addition, we can also programmaticall y embeded asp.net applicaiton root
path in html like:

<img src='<%= ResolveUrl("~/Images/titlebar.gif") %>' />

Hope also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Nalaka" <na******@nospa m.nospam>
| References: <uK************ *@TK2MSFTNGP15. phx.gbl>
<ua************ **@tk2msftngp13 .phx.gbl>
| Subject: Re: master pages and image URL
| Date: Mon, 19 Dec 2005 11:20:28 -0800
| Lines: 47
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#0************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc. ca 199.60.181.9
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3657 69
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Thanks.. will try
|
| "Teemu Keiski" <jo****@aspalli ance.com> wrote in message
| news:ua******** ******@tk2msftn gp13.phx.gbl...
| > Have you tried giving the image url in format such as
| >
| > "~/images/image.gif"
| > e.g tilde at start of the path. ~ refers to the root of the web
| > application
| >
| > For longer explanation, please see:
| >
http://www.aspnetpro.com/newslettera..._l/asp200311kd
_l.asp
| >
| > --
| > Teemu Keiski
| > ASP.NET MVP, AspInsider
| > Finland, EU
| > http://blogs.aspadvice.com/joteke
| >
| >
| > "Nalaka" <na******@nospa m.nospam> wrote in message
| > news:uK******** *****@TK2MSFTNG P15.phx.gbl...
| >> 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 shown, all images (inclding
masterpage)
| >> are resoved relative to the content page location.
| >>
| >> get get around this I copy all master page images to the sub folders
| >> too......
| >>
| >> this happens with the .ascx (user controls) too....
| >>
| >> is there another soulution to setting up these image urls so that I
dont
| >> have to duplicate it.
| >>
| >>
| >> thanks in advance.
| >> Nalaka
| >>
| >>
| >
| >
|
|
|

Dec 20 '05 #5
You're welcome Nalaka,

If anything else we can help, please feel free to post here.

regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Nalaka" <na******@nospa m.nospam>
| References: <uK************ *@TK2MSFTNGP15. phx.gbl>
<ua************ **@tk2msftngp13 .phx.gbl>
<#0************ **@TK2MSFTNGP12 .phx.gbl>
<yn************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: Re: master pages and image URL
| Date: Tue, 20 Dec 2005 09:22:57 -0800
| Lines: 114
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <Oa************ *@TK2MSFTNGP12. phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc. ca 199.60.181.9
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3660 22
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| thanks....
| let me try...... <img src='<%= ResolveUrl("~/Images/titlebar.gif") %>' />
| imageUrl did not like "~/xxx" directly.
|
| Nalaka
|
|
|
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:yn******** ********@TK2MSF TNGXA02.phx.gbl ...
| > Thanks for Teemu's good suggestion.
| >
| > Hi Nalaka,
| >
| > As Teemu has mentioned , the "~/...." path point to the ASP.NET's
| > application root. So if you're using asp.net server control , we can
| > always
| > use this style path since it is easy to locate resource.... And for
some
| > cases that we will embeded static html element that'll point to some
| > resources, we may need to use static path , such as /.../..... which
| > start from website root (not web app root...) or just reletive path.....
| >
| > In addition, we can also programmaticall y embeded asp.net applicaiton
root
| > path in html like:
| >
| > <img src='<%= ResolveUrl("~/Images/titlebar.gif") %>' />
| >
| > Hope also helps.
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | From: "Nalaka" <na******@nospa m.nospam>
| > | References: <uK************ *@TK2MSFTNGP15. phx.gbl>
| > <ua************ **@tk2msftngp13 .phx.gbl>
| > | Subject: Re: master pages and image URL
| > | Date: Mon, 19 Dec 2005 11:20:28 -0800
| > | Lines: 47
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Response
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | Message-ID: <#0************ **@TK2MSFTNGP12 .phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: m181-9.bctransit.bc. ca 199.60.181.9
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3657 69
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | Thanks.. will try
| > |
| > | "Teemu Keiski" <jo****@aspalli ance.com> wrote in message
| > | news:ua******** ******@tk2msftn gp13.phx.gbl...
| > | > Have you tried giving the image url in format such as
| > | >
| > | > "~/images/image.gif"
| > | > e.g tilde at start of the path. ~ refers to the root of the web
| > | > application
| > | >
| > | > For longer explanation, please see:
| > | >
| >
http://www.aspnetpro.com/newslettera..._l/asp200311kd
| > _l.asp
| > | >
| > | > --
| > | > Teemu Keiski
| > | > ASP.NET MVP, AspInsider
| > | > Finland, EU
| > | > http://blogs.aspadvice.com/joteke
| > | >
| > | >
| > | > "Nalaka" <na******@nospa m.nospam> wrote in message
| > | > news:uK******** *****@TK2MSFTNG P15.phx.gbl...
| > | >> 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 shown, all images (inclding
| > masterpage)
| > | >> are resoved relative to the content page location.
| > | >>
| > | >> get get around this I copy all master page images to the sub
folders
| > | >> too......
| > | >>
| > | >> this happens with the .ascx (user controls) too....
| > | >>
| > | >> is there another soulution to setting up these image urls so that I
| > dont
| > | >> have to duplicate it.
| > | >>
| > | >>
| > | >> thanks in advance.
| > | >> Nalaka
| > | >>
| > | >>
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Dec 21 '05 #6

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

Similar topics

1
2214
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 submenus. These events are attached to javascript functions which rely on the image id to appropately locate and swap images, display submenus at the right location, etc. Anyways, this worked fine initially in 2.0, but when I introducted master...
2
3311
by: news.sbcglobal.net | last post by:
I hope I can explain this well enough to understand. I have a master page that is used by almost all of the pages in my site. On the master page is a table. In one of the cells in this table, I have set the background to display an image that is located in a directory called "images" which is just off the root directory. Here's the problem: Any page that is not located in the root directory (where the master page is located) cannot...
2
6968
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 header. I tried to put the link tag in the Master page, but the classes are not recognized in the Content Page. How do I use a StyleSheet with the Content Page? TIA
8
6682
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 and also my first true attempt at using master pages. I tried setting up a style sheet with a simple setting to float an image to the right and it had no effect on the image. Then, I tried putting the style code in my ASPX file as such,
4
4048
by: JimHeavey | last post by:
If on my master page I have an image which is in the image folder. For web pages which are in the "default" directory, the image displays just fine. But if one of my pages which "utilizes" the master page is in a folder called "Fred", the image is not resolved. If I change the reference to the "src" to "../image", then the image is resolved just fine on the web page which is in the "Fred" directory, but does not resolve the location...
3
4035
by: Admin.TalkPC | last post by:
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
2
1705
by: Stratum | last post by:
It's an old question, and I apologize for raising it again. I use ImageButton objects on my ASP.Net master page to navigate to content pages. For each button, I have two images. One image shows black print on a white background, and the other image shows the same printing in white on a red background to indicate the content page which is presently loaded. When I navigate between pages, I want the
5
1514
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, image control etc onto the master page, I don't see these added to any of the pages that is using the Master page as a template even after I save & rebuild. Is this expected bahaviour & if so, how do I set up say, menus using a layout or table &...
8
1288
by: Cirene | last post by:
I have 1 master page in the root of my website that I would like to share with all pages, even those in my /admin and /client directories. But when pages in the subdir's are viewed the img, css, etc... references are incorrect because they are "root based". Any suggestion as to how to overcome this? Or do I have to create another Master Page for the subdir pages? Thansk!
0
8015
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
8439
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
8430
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
8094
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
6770
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...
0
5465
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3930
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1296
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.