Reputation: 443
I am getting the following error while loading a page.
[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
No idea what to do ? Can anyone help me ?
Upvotes: 1
Views: 23218
Reputation: 163
Apologies as this is very old, but I have had this problem for a few days now on an MVC3 app. I kept going into my _Layout.cshtml file and deleting any reference to css files or javascript (I was using JQuery in this app) to find the dreaded ../ reference. I couldn't find one. Then I tried to bypass my issue by just dropping a redirect into my application's root directory. That failed too. The stack track on the YellowScreenOfDeath gave me a clue:
[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
System.Web.Util.UrlPath.ReduceVirtualPath(String path) +11496719
System.Web.Util.UrlPath.Reduce(String path) +171
System.Web.Configuration.**AuthenticationConfig**.GetCompleteLoginUrl(HttpContext context, String loginUrl) +218
System.Web.Security.FormsAuthenticationModule.OnEnter(Object source, EventArgs eventArgs) +156
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Bottom line, I had this in my web.config with a "../" Deleting this or changing the up reference fixed my issue.
<authentication mode="Forms">
<forms loginUrl="../home.aspx" timeout="2880" />
</authentication>
Upvotes: 0
Reputation: 1653
I realize this is as old as sin, but what caused it for me was that I had a relative link for an image in the db set with a ../. When my page tried to load the ImageUrl for the image in the root directory it worked fine but in sub-directories it wigged out.
Changing it to a ~ fixed the problem.
Upvotes: 1
Reputation: 2181
I was able to solve this problem by setting the cookieless-attribute on the forms-tag in web.config:
<authentication>
<forms cookieless="UseCookies" />
</authentication>
Upvotes: 0
Reputation: 675
Most likely a googlebot or some other bots are killing your website.
http://www.kowitz.net/archive/2006/12/11/asp.net-2.0-mozilla-browser-detection-hole.aspx
http://todotnet.com/post/2006/07/01/Get-GoogleBot-to-crash-your-NET-20-site.aspx
solution is to add .browser files in the app_browser folder of your website.
Upvotes: 1
Reputation: 12589
Depending on your circumstances this may or may not help but I had this error last week. The solution for me was to change the Web settings in My Project to use the local IIS server instead of the Visual Studio web server.
Upvotes: 0
Reputation: 25330
I'm guessing you have done something like this:
Response.Redirect("../SomePage.aspx");
When using relative paths, you can only navigate to pages that are in the same Virtual Directory as the one the page making the request is in. What you have done is called this from a page that is at the top of the Virtual Directory tree. So you have some options:
../
http://www.example.com/SomePage.aspx
For Option 3:
Upvotes: 4