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

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 1703
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******@nospam.nospam> wrote in message
news:uK*************@TK2MSFTNGP15.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****@aspalliance.com> wrote in message
news:ua**************@tk2msftngp13.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******@nospam.nospam> wrote in message
news:uK*************@TK2MSFTNGP15.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 programmatically 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******@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc.ca 199.60.181.9
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365769
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks.. will try
|
| "Teemu Keiski" <jo****@aspalliance.com> wrote in message
| news:ua**************@tk2msftngp13.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******@nospam.nospam> wrote in message
| > news:uK*************@TK2MSFTNGP15.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****************@TK2MSFTNGXA02.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 programmatically 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******@nospam.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc.ca 199.60.181.9
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365769
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks.. will try
|
| "Teemu Keiski" <jo****@aspalliance.com> wrote in message
| news:ua**************@tk2msftngp13.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******@nospam.nospam> wrote in message
| > news:uK*************@TK2MSFTNGP15.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******@nospam.nospam>
| References: <uK*************@TK2MSFTNGP15.phx.gbl>
<ua**************@tk2msftngp13.phx.gbl>
<#0**************@TK2MSFTNGP12.phx.gbl>
<yn**************@TK2MSFTNGXA02.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: m181-9.bctransit.bc.ca 199.60.181.9
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366022
| X-Tomcat-NG: microsoft.public.dotnet.framework.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****************@TK2MSFTNGXA02.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 programmatically 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******@nospam.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.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: m181-9.bctransit.bc.ca 199.60.181.9
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:365769
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Thanks.. will try
| > |
| > | "Teemu Keiski" <jo****@aspalliance.com> wrote in message
| > | news:ua**************@tk2msftngp13.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******@nospam.nospam> wrote in message
| > | > news:uK*************@TK2MSFTNGP15.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
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
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...
2
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...
8
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...
4
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...
3
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
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...
5
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,...
8
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.