Re: master pages and image URL



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" <nalaka12@xxxxxxxxxxxxx>
| References: <uKpv0SMBGHA.216@xxxxxxxxxxxxxxxxxxxx>
<uaH7peMBGHA.2356@xxxxxxxxxxxxxxxxxxxx>
| 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: <#0MoGFNBGHA.2708@xxxxxxxxxxxxxxxxxxxx>
| 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!TK2MSFTNGP12.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" <joteke@xxxxxxxxxxxxxxx> wrote in message
| news:uaH7peMBGHA.2356@xxxxxxxxxxxxxxxxxxxxxxx
| > 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/newsletterarticle/2003/11/asp200311kd_l/asp200311kd
_l.asp
| >
| > --
| > Teemu Keiski
| > ASP.NET MVP, AspInsider
| > Finland, EU
| > http://blogs.aspadvice.com/joteke
| >
| >
| > "Nalaka" <nalaka12@xxxxxxxxxxxxx> wrote in message
| > news:uKpv0SMBGHA.216@xxxxxxxxxxxxxxxxxxxxxxx
| >> 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
| >>
| >>
| >
| >
|
|
|

.



Relevant Pages

  • Re: master pages and image URL
    ... > Hi Nalaka, ... > application root. ... > | Subject: Re: master pages and image URL ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: master pages and image URL
    ... Have you tried giving the image url in format such as ... ~ refers to the root of the web application ... > When an image is put on a master page... ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: master pages and image URL
    ... > Have you tried giving the image url in format such as ... ~ refers to the root of the web ... >> When an image is put on a master page... ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Sometime the JavaScript function becomes undefined
    ... Try to add the reference in code by putting this line into Your master pages Load instead of the block in Your markup: ... Can't I capture that folder name and store it in a session variable? ... I always get openWindow is undefined. ... Without the leading slash it works ok from Default.aspx which is in the root with the master ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: More than One
    ... affect the sub applications. ... In addition, for Master page, we can put different Master pages in ... referece Master pages in root application directory, ... Microsoft Online Support ...
    (microsoft.public.dotnet.framework.aspnet)