Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Morning Friends,
Today i have hosted a website when i run locally the site its working fine . When i hosted the home page Displaying fine , and when click the submenus and some readmore file the page is re-directing to that page and diaplaying an error page .

As

Server Error in '/' Application.

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

CSS
Exception Details: System.Web.HttpException: Cannot use a leading .. to exit above the top directory.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



Please help me friends to rectify the error
Posted
Comments
DamithSL 13-Dec-14 0:10am    
so where is the stack trace?
ManojMurali 13-Dec-14 1:18am    
Stack Trace:


[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
System.Web.Util.UrlPath.ReduceVirtualPath(String path) +8962539
System.Web.Util.UrlPath.Reduce(String path) +52
System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +214
System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +180
System.Web.UI.HtmlControls.HtmlLink.RenderAttributes(HtmlTextWriter writer) +74
System.Web.UI.HtmlControls.HtmlLink.Render(HtmlTextWriter writer) +42
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +17
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

Version Information: Microsoft .NET Framework Version:2.0.50727.6421; ASP.NET Version:2.0.50727.6420

refer this previous questions:
Cannot use a leading .. to exit above the top directory. CP[^]
Cannot use a leading .. to exit above the top directory. SO[^]

UPDATE:
HTML
< a href='<%=ResolveUrl("~/Links/Vission.aspx") %>'>Our Vision</a>
< a href='<%=ResolveUrl("~/Links/Mission.aspx") %>'>Our Mission</a>
 
Share this answer
 
v3
Comments
ManojMurali 13-Dec-14 0:32am    
Thanks for your Response Mr DamithSL,

Her i am using the menu code as like this

<li>Our Vision</li>
<li>Our Mission</li>

in default page, when i running the website locally its working fine but when i hosted and running the redirecting page is getting error as shown above.can u help me
ManojMurali 13-Dec-14 0:35am    
Thanks for your Response Mr Mr DamithSL,

Her i am using the menu code as like this

< a href="Links/Vission.aspx"> Our Vision


in default page, when i running the website locally its working fine but when i hosted and running the redirecting page is getting error as shown above.can u help me
DamithSL 13-Dec-14 0:40am    
check my updated answer
ManojMurali 13-Dec-14 1:20am    
I Checked, again getting same error,
When i take out the pages from links folder and put outside the root its working fine. but its not good know. so can you give me a solution please.
DamithSL 13-Dec-14 1:24am    
in which page you have this menu and what is the location of that page?
what is the location of Vision and mission pages?
what is the location of your web site root folder?
Just Remove .. from your redirect url like below:

C#
// Response.Redirect("../aDir/WebForm1.aspx");   Your Error code
 Response.Redirect("/aDir/WebForm1.aspx");  // Your Solution
 
Share this answer
 
v2
Comments
ManojMurali 13-Dec-14 0:32am    
Thanks for your Response Mr Anisuzzaman Sumon,

Her i am using the menu code as like this

<li>Our Vision</li>
<li>Our Mission</li>

in default page, when i running the website locally its working fine but when i hosted and running the redirecting page is getting error as shown above.can u help me
ManojMurali 13-Dec-14 0:34am    
Thanks for your Response Mr Anisuzzaman Sumon,

Her i am using the menu code as like this

< a href="Links/Vission.aspx"> Our Vision


in default page, when i running the website locally its working fine but when i hosted and running the redirecting page is getting error as shown above.can u help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900