none
Cannot use a leading .. to exit above the top directory.

    Question

  • Hi All,

    I have designed a master page in Share point Designer 2007. When I see the preview of .aspx page which has master page included , i am not getting any error but when Developers  use that perticular master page for development at that time there are getting following error

    Cannot use a leading .. to exit above the top directory.

    I have used few images and those image have path like this

    ../../../Style Library/Images/My Floder/Imagename.jpg

    can you please tell me that what is the solution for this so developer can use the master page without any error.?


    Regards.

    Vishal
    Monday, September 15, 2008 3:03 PM

Answers

  • Hey Vishal,
    I put the asp:image control on my master page and it worked.
    All I did was copy your code out and paste it in my master page, then I just pointed to one of my images in my style library.
    It didn't work at first because you had a space between ASP: and Image. So, I changed it to ASP:Image and it worked.
    Anyways, I thought you might want to know this in case you still want to use the ASP:Image control.
    Also, if it doesn't work at first for you, I would recommend an app pool recycle or IIS reset (you never know :)
    Monday, September 15, 2008 8:35 PM

All replies

  • Does your Style LIbrary live at the site collection level? It usually does.
    If so, setting your url image to something like this: ="<% $SPUrl:~sitecollection/Style Library/Images/My Folder/Imagename.jpg %>"
    Monday, September 15, 2008 4:49 PM
  • Thanks Greg ,

    Thanks for replying. I tried "<% $SPUrl:~sitecollection/Style Library/Images/ ..." but its giving me an error.

    Error Rendering control

    An unhandled exception has occured. The Expressing prefix "SPUrl" was not recognized.


    I have <ASP: Image ></ASP:Image> control  for showing images...

    Monday, September 15, 2008 6:21 PM
  • Interesting.
    How did you code it up? Did you set the property? Could you place the code in here?
    Here is an example of how I have done it in the past. I have never done it in a server side image, I usually just use html img controls. Try doing it like this:
    <img runat="server" src="<% $SPUrl:~SiteCollection/Style Library/Images/My Folder/Imagename.jpg%>" />

    The above code should work. And, because I have runat="server" you can access it in a code behind if you want to. So, you don't really need to use ASP:Image, unless there is some really specific reason you need to, but I don't know of any off the top of my head.
    Monday, September 15, 2008 6:29 PM
  • Hi Greg,

    Thaks for reply. If i put HTMl Image control then its workin but my question is that what its not working with <ASP:Image> control?

    My conde of ASP image control was

    <ASP: Image id="imgbull" runat="server" ImageUrl="<% $SPUrl:~sitecollection/Style Library/Images/Fredd/Orangebull.jpg %>"></ASP:image>

    I just wanted to know that if its working with HTML image control then whay its not working with ASP image control.

    Please let me know if you have any idea about this ...


    Vishal
    Monday, September 15, 2008 7:26 PM
  • Hey Vishal,
    There might be a way to do that, but before I start looking into it, can I ask why?
    I can't think of any reason that <ASP: Image... is better than <img runat="server"...
    You should be able to do the same things with each of them. Maybe there is a reason why it is better in your situation, but if there isn't I would recommend using regular img tags and setting runat="server".
    Of course, I stipulate this statement with "maybe there is a reason". Just because I can't think of one right now, doesn't mean there isn't one.
    Monday, September 15, 2008 7:57 PM
  • Hey Vishal,
    I put the asp:image control on my master page and it worked.
    All I did was copy your code out and paste it in my master page, then I just pointed to one of my images in my style library.
    It didn't work at first because you had a space between ASP: and Image. So, I changed it to ASP:Image and it worked.
    Anyways, I thought you might want to know this in case you still want to use the ASP:Image control.
    Also, if it doesn't work at first for you, I would recommend an app pool recycle or IIS reset (you never know :)
    Monday, September 15, 2008 8:35 PM
  • Change “..” into “~”. I've described more about this problem, here: http://www.developerbits.com/2012/12/21/cannot-use-a-leading-to-exit-above-the-top-directory/
    Thursday, December 27, 2012 7:17 PM