ASP.Net Error Help: "Unable to use host .. to exit top directory"

I see this error several times per hour at my production site and am not quite sure how to fix it. I copied the source code and I do not use "../" anywhere in my code to generate the path.

My application runs on IIS6 on a Win2003 server. It uses URLRewriter.Net so that the site has friendly URLs, and I am wondering if this could affect the problem.

I already had Googled to solve and found several features, but no one worked for me.

I tried to create a new App_Browser file to force the tagwriter parameters to use a specific HtmlTextWriter, as suggested in one of the most popular solutions, but this did not work for me. I have not seen any other possible solutions.

Thanks in advance for your help.

+4
source share
6 answers

This is probably due to the use of "~ / something", possibly in a Hyperlink control. When the physical file is at a different directory level from a friendly URL, ASP.NET uses too much ../ in the relative URL that it generates, giving this error. If you can't just use the absolute URL instead, I believe you can use Page.ResolveUrl ("~ / foo / bar") to get the correct relative URL.

+3
source

Just set the Enable Parent Paths option to True in the ASP settings on your website

This solved the problem for me

+1
source

Use a reflector to insert the URLRewriter.Net code.

0
source

I would pass your rewrite paths one more time and see if there is a path that contains a folder that either does not exist, has been tricked, or is actually located outside the web application. Can you post a rewrite rule here?

0
source

Are you sure you are causing the error ?. Some scripts (Code Red / Nimda) troll the Internet, looking for URL traffic that looks like this error.

Is it internal or external? Is it possible that your machine will be scanned?

0
source

I was able to solve this problem by installing .NET 3.5 SP1.

0
source

Source: https://habr.com/ru/post/1277564/


All Articles