3

I'm getting this error when I start my project

It is being caused by the css and js files in the master page.

<link href="../assets/css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />

When I remove this line the project starts functioning correctly(without the style)

Any ideas Sp

H H
  • 263,252
  • 30
  • 330
  • 514
Steven
  • 2,148
  • 8
  • 33
  • 50
  • Fix the bad .. file path in the css/script file? Edit - Ok with edit, I would assume your just starting one level to deep. If you delete the href line and retype it VS will open a dialog window to help you pick the file. Use that path instead. If this is mvc it is also useful to write something like href="@Url.Content(path)" so that it works when the path is moved around on the different server pages. – asawyer Dec 06 '11 at 14:43
  • Chances are the style is referencing something "past the domain". e.g. if the file is in `/styles/style.css` there is a reference to `../../images/foo.jpg` (which would be going up one too many directories) – Brad Christie Dec 06 '11 at 14:44
  • possible duplicate of http://stackoverflow.com/questions/2262271/cannot-use-a-leading-to-exit-above-the-top-directory – huMpty duMpty Dec 06 '11 at 14:44
  • 1
    How can we help you, when we don't see the trouble making code? – Fischermaen Dec 06 '11 at 14:44
  • What's the error? Does the ".." reach outside of the webroot? – Matt Murrell Dec 06 '11 at 14:45
  • 1
    use absolute paths instead of ../ – Stefan Koenen Dec 06 '11 at 14:46
  • I have tried the tide and I still get the same problem..@Fishermaen The code above is the line that is causing the issue thus why I've posted, but thanks for your wasted comment....! – Steven Dec 06 '11 at 14:52
  • @Steven Your question doesn't have enough information as stated to help without us guessing at the details. Fischermaen is trying to help you, and that was a very rude response. I don't see how you can honestly expect others give you help freely if you are going to respond with comments like that. – asawyer Dec 06 '11 at 14:55
  • I have put everything I know above and don't feel that his comments were very constructive. – Steven Dec 06 '11 at 14:59
  • Steve, I had to correct your formatting. Click the edit-time to see that in you original post it was invisible. Always proof-read a question. – H H Dec 06 '11 at 15:09
  • I've seen both on IIS and apache (on linux) that it will only go to the root and never past. ../../../../images will work just like ../image. Is this just me? – Dustin Davis Dec 06 '11 at 16:15

1 Answers1

7

Since this is ASP.NET, use a tilde ~ to mark the application root:

<link href="~/assets/css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
H H
  • 263,252
  • 30
  • 330
  • 514
  • I have tried this but it still causes the same issue. All code works if the .aspx file is in the root dir of the site – Steven Dec 06 '11 at 14:53
  • OK, I have corrected a typo. Take a good look at your folder structure and write out the correct URL. – H H Dec 06 '11 at 14:58