473,807 Members | 2,853 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another topic on "Cannot use a leading .. to exit above the top directory"

A number of topics ask how to solve the "Cannot use a leading .. to
exit above the top directory" error.

I am having the same problem with an asp.net 2.0 website. The site
works fine on Localhost, but not when I move the site to my hosting
company.

I've read that turning the Parent Paths option to ON in the IIS
properties should do the trick. It is ON for both my localhost and my
online host. Only the localhost still works.

I've switched hardcoded links from "../app/mypage.aspx" where ../
(brings you to the Root directory) to "/app/mypage.aspx" thinking that
the ".." is what is causing the problem.

The site implements a Masterpage in the root directory.

Maybe this is some kind of permissions thing?

Please please help!

Jan 18 '06 #1
1 3964
After some careful fiddling around for a couple hours, I figured out
what the problem was. First of all, note that Parent Paths has nothing
to do with the issue. They can be on or off.

If your head section has the runat server (<head runat="server"> ), and
you are using Masterpages, and aren't or are using Themes but still
have a <link href="../styles/styles.css" rel="stylesheet " /> in your
Head section, because the Head section is process at the server, it
will add at least one but could be more " ../ ".

If you use themes, take out the <link href....>. Using themes will
automatically link any CSS in your Theme directory and will link with
the proper

The ../ is also added to some other HTML elements like the FAVICON
link.

For stylesheets, you can still use
<style type="text/css">
@import "../styles/layout.css";
</style>
Asp.net will not add a ../ to that.

You can also do this:
<script type="text/javascript">
//<![CDATA[
document.write( '<link rel="Stylesheet " type="text/css" href="<%=
Page.ResolveUrl ("~/styles/styles.css") %>" />');
and it will work. This was posted on
http://www.telerik.com/Default.aspx?...02&b311D=orJO1
and was what made me realize that the extra ../ get's added to elements
when you have the runat server in the Head.

Please note that you cannot simply use HTML comments (<!-- -->) to
comment out any hardcoded <link rel=stylesheet> elements. So what I
mean is, you cannot go
<!-- <link href="../styles/styles.css" rel="stylesheet " /> -->
You MUST use Asp.Net comment code:
<%= <link href="../styles/styles.css" rel="stylesheet " /> -->

As far as I can, after hours of searching, this is THE solution.

- your us
If you have this problem
webonomic wrote:
A number of topics ask how to solve the "Cannot use a leading .. to
exit above the top directory" error.

I am having the same problem with an asp.net 2.0 website. The site
works fine on Localhost, but not when I move the site to my hosting
company.

I've read that turning the Parent Paths option to ON in the IIS
properties should do the trick. It is ON for both my localhost and my
online host. Only the localhost still works.

I've switched hardcoded links from "../app/mypage.aspx" where ../
(brings you to the Root directory) to "/app/mypage.aspx" thinking that
the ".." is what is causing the problem.

The site implements a Masterpage in the root directory.

Maybe this is some kind of permissions thing?

Please please help!


Jan 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3965
by: Fie Fie Niles | last post by:
I have IIS installed on XP Professional workstation machine. I have an ASP page that open connection to an Access database, then when trying to update the database, it gave me the error "cannot update database or object is read-only". This is a workstation machine, not connected to any other computer, and I login to the PC using an administrator account. I already check the .MDB file is NOT read-only. But, I do not see the .LDB file....
1
3641
by: Chris | last post by:
I built small C# Web and Web Service applications in a training class last week. The applications worked in the class, but when I tried to run them again over the weekend, they both bombed. Instead of getting my Web page, or the Web Service page, I get a page full of error text (below). I am hoping the anwser will be obvious to someone. I've tried a few things to address the problem, including
0
2094
by: Mike Schnorr | last post by:
I have a ASP.Net application that uses assemblies from several other solutions. When testing the applications on my machine I build all the referenced assemblies using nmake. The latest assemblies get placed in a common directory that is referenced by my ASP.NET app. Occasionally I receive the following error: value of type "MyNamespace.MyClassName" cannot be converted to "MyNamespace.MyClassName" (there are a lot of these for different...
5
1996
by: Chris Robb | last post by:
I'm having some really odd behavior with a PHP script. I have it populating an HTML select form with a for loop. When I try the years 2006 to 1900. I get the following error: PHP Warning: Cannot modify header information - headers already sent by (output started at /Users/chrobb/Sites/city-directory/controlBar.php:54) in /Users/chrobb/Sites/city-directory/controlBar.php on line 88 I've done a fair amount of searching and it looks...
19
11508
by: ern | last post by:
Right now I'm using exit(0) to terminate my program. My program is a console .exe application. After the "exit(0)" line of code is encountered, the console application waits for an enter press, before terminating. I want it to terminate completely without having to press enter manually. Anybody know what I might be missing here ?
6
4117
by: Don Lancaster | last post by:
I need to progrmatically do this inside a loop this.fh03.value = fixFloat (Harms, numPoints) ; with the numbers changing per an index. If I try curHvals = "03" ; // (derived from index to provide leading zero)
4
4765
by: GHUM | last post by:
The compile works, BUT linking fails: 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc: \python25\PCBuild -Lc:/p ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build \lib.win32-2.5\psy copg2\_psycopg.pyd c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lpq collect2: ld returned 1 exit status
4
3294
by: k3pp0 | last post by:
Hey. I've got a very basic newbie question, I hope you can understand me. Sorry for asking it, first of all. I see a lot of sites (e.g. communities) with a url-structure like this: example.com/users/paul (displaying the user profile of "paul") or example.com/pictures/landscapes/13 (displaying pictures from the category "landscapes", page 13). These are just examples, I hope I didn't confuse you.
2
4007
by: dstork | last post by:
Anyone know how to rename the "Exit Access" command at the bottom of the Office menu. I'd like to rename it to "Exit" as I had done in previous versions of Access. I know I can disable it with <commands> <command idMso="FileExit" enabled="false"/> </commands> .... but what about renaming it?
0
9720
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9599
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10626
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.