master pages and image URL

Discussion in 'Microsoft ASP .NET' started by Nalaka, Dec 19, 2005.

  1. Nalaka

    Nalaka Guest

    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
     
    Nalaka, Dec 19, 2005
    #1
    1. Advertisements

  2. Nalaka

    Teemu Keiski Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Teemu Keiski, Dec 19, 2005
    #2
  3. Nalaka

    Nalaka Guest

    Thanks.. will try

    "Teemu Keiski" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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
    >>
    >>

    >
    >
     
    Nalaka, Dec 19, 2005
    #3
  4. 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" <>
    | References: <>
    <>
    | 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: <#>
    | 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" <> wrote in message
    | news:...
    | > 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" <> wrote in message
    | > news:...
    | >> 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
    | >>
    | >>
    | >
    | >
    |
    |
    |
     
    Steven Cheng[MSFT], Dec 20, 2005
    #4
  5. Nalaka

    Nalaka Guest

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

    Nalaka



    "Steven Cheng[MSFT]" <> wrote in message
    news:yn%...
    > 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" <>
    > | References: <>
    > <>
    > | 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: <#>
    > | 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" <> wrote in message
    > | news:...
    > | > 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" <> wrote in message
    > | > news:...
    > | >> 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
    > | >>
    > | >>
    > | >
    > | >
    > |
    > |
    > |
    >
     
    Nalaka, Dec 20, 2005
    #5
  6. 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" <>
    | References: <>
    <>
    <#>
    <yn#>
    | 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: <>
    | 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: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]" <> wrote in message
    | news:yn%...
    | > 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" <>
    | > | References: <>
    | > <>
    | > | 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: <#>
    | > | 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" <> wrote in message
    | > | news:...
    | > | > 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" <> wrote in message
    | > | > news:...
    | > | >> 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
    | > | >>
    | > | >>
    | > | >
    | > | >
    | > |
    | > |
    | > |
    | >
    |
    |
    |
     
    Steven Cheng[MSFT], Dec 21, 2005
    #6

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh

    redirect URL's, return URL's, and URL Parameters

    Jon paugh, Jul 9, 2004, in forum: Microsoft ASP .NET
    Replies:
    1
    Views:
    1,252
  2. Electrified Research

    Master Pages Great! But what about Master User Controls?

    Electrified Research, Oct 10, 2005, in forum: Microsoft ASP .NET
    Replies:
    5
    Views:
    267
    Guest
    Oct 11, 2005
  3. Roel

    Themes + Picture relative url + Master Pages

    Roel, Dec 20, 2005, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    187
  4. Replies:
    1
    Views:
    595
    PeterKellner
    May 16, 2006
  5. Sam
    Replies:
    0
    Views:
    341
Loading...

Share This Page