Referencing root document in <IMG> tag...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Edward

    Referencing root document in <IMG> tag...

    I have a subdirectory with an aspx page that references a master file
    located in the root.

    In the master file template I reference a logo/image that is in
    <root>/resources...
    <img alt="logo" src="./resources/logo.png" />

    For some reason when I pull up the page in the subdirectory it only shows
    the alt tag because i think it can't find the png. Any idea why?

    Other references used in the master file template are ok, such as...
    <asp:Hyperlin k runat="server"
    NavigateUrl="./register.aspx"> Register</asp:Hyperlink>

    It finds the register.aspx in the <rootof the website.

    Can you help me? Thanks!


  • Alexey Smirnov

    #2
    Re: Referencing root document in &lt;IMG&gt; tag...

    On Sep 21, 4:48 am, "Bobby Edward" <bo...@nobody.c omwrote:
    I have a subdirectory with an aspx page that references a master file
    located in the root.
    >
    In the master file template I reference a logo/image that is in
    <root>/resources...
    <img alt="logo" src="./resources/logo.png" />
    >
    For some reason when I pull up the page in the subdirectory it only shows
    the alt tag because i think it can't find the png.  Any idea why?
    >
    Other references used in the master file template are ok, such as...
    <asp:Hyperlin k runat="server"
    NavigateUrl="./register.aspx"> Register</asp:Hyperlink>
    >
    It finds the register.aspx in the <rootof the website.
    >
    Can you help me?  Thanks!
    Because Hyperlink is a server control, and img is an html tag. Calling
    this

    <img alt="logo" src="./resources/logo.png" />

    from the http://root/subdir/page.aspx would call an image from


    If your master is always in the root, there is no reason to use "." in
    the url.

    Use this

    <img alt="logo" src="/resources/logo.png" />

    to tell to all content pages that the image location is in the <root>/
    resources

    Hope this helps

    Comment

    • Bobby Edward

      #3
      Re: Referencing root document in &lt;IMG&gt; tag...

      Thanks Alexey!


      Comment

      Working...