Redirection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abdul Haque
    New Member
    • May 2007
    • 17

    #16
    use this syntax
    <img src="/images/ad.gif" >

    i.e. a root relative path, instead of 'document relative' or 'absolute path'

    Comment

    • Nitinkcv
      New Member
      • Mar 2007
      • 65

      #17
      Originally posted by Abdul Haque
      use this syntax
      <img src="/images/ad.gif" >

      i.e. a root relative path, instead of 'document relative' or 'absolute path'
      Hi,
      no this too doesnt work

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #18
        Funny, I do the same thing.
        I have a website at

        which has folders:
        admin/ (http://mywebsite/mywebmodule/admin/default.aspx)
        user/ (http://mywebsite/mywebmodule/user/default.aspx)
        images/ (where all my pictures sit)

        I use this with no problem in all of my pages (regardles of the folder)
        [html]
        <asp:Image ID="Image1" runat="server" ImageUrl="~/images/rxbanner.JPG" AlternateText=" my alt text" />
        [/html]

        With that being said though, the ~ only applies when used in the .aspx page (the designer page) and not in C# code.
        The ~ is a pre-compiler command that will get replaced at runtime with the url. It does not apply to the backend. (That means you cannot use it in Response.Redire ct() calls)
        I recomend you make some kinda global method or something that will return the begining url you want. Inside that method you can either "hard-code" the /MyVirtualDirect ory/ or you can write up code devised to extract the virtual directory based upon the Request.Url

        Comment

        Working...