../../../test正在给404文件或文件夹找不到错误 [英] ../../../test is giving 404 file or folder not found error

查看:96
本文介绍了../../../test正在给404文件或文件夹找不到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET MVC应用程序托管在Web服务器上,URL为http://10.26.14.99/projectA即environment1,同一个应用程序托管在另一个带有URL https://projectA.test.com的web服务器上,即environment2 。



现在,对于environment1,当我输入http://10.26.14.99/projectA/../../../../test它显示如果我输入https://projectA.test.com/../../,则URL为http://10.26.14.99/test,404文件或文件夹未找到错误,但同时适用于environment2。 ./../test然后它将URL显示为https://projectA.test.com/test,它还会将我带到预期的登录页面。



任何人都可以告诉我在environment1中需要做些什么来获得与environment2相同的预期结果?



我尝试过:



1.我尝试了配置更改,如重写,httperrors来处理403错误和自定义错误来处理其他错误。

我也试过创造汉dler for pattern* .. / *如果URL包含../则引发错误,但这也没有用。



我认为在环境1的情况下它甚至没有达到我的应用程序代码库。

I have an ASP.NET MVC application hosted in web server with URL http://10.26.14.99/projectA i.e. environment1 and same application is hosted in another web server with URL https://projectA.test.com i.e. environment2.

Now, for environment1 when I enter http://10.26.14.99/projectA/../../../../test it is showing the URL as http://10.26.14.99/test with 404 "File or Folder not found" error but at the same time for environment2 when if i enter https://projectA.test.com/../../../../test then it is showing the URL as https://projectA.test.com/test and it also takes me to the login page which is expected.

Can anyone please tell me what need to be done in environment1 to get the same expected result as the environment2?

What I have tried:

1. I tried the config changes like rewrite, httperrors to handle 403 error and custom errors to handle other errors.
2. I also tried by creating handler for pattern "*../*" to raise error if URL contains "../" but this also didn't worked.

I think it is not even hitting my application codebase in case of environment1.

推荐答案

做了什么你期待吗?

What did you expect?
http://10.26.14.99/projectA/../../../../test



在一个路径中,..是一个相对文件夹说明符:它表示上面的文件夹。

所以你要求


In a path, ".." is a relative folder specifier: it says "folder above".
So you are asking for

root / projectA / folder above (giving root) / folder above root / folder above that / folder above that / test



你不能使用相对说明符去在根文件夹上方!

所以你得到了一个404,正确。


You cannot use a relative specifier to go above the root folder!
So you get a 404, correctly.


这篇关于../../../test正在给404文件或文件夹找不到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆