为什么页面以...开头非法?

时间:2021-12-10 05:27:21

I have a page called ..hi i get this error when visiting the page. Why is that illegal?

我有一个名为..hi的页面我在访问该页面时遇到此错误。为什么这是非法的?

Server Error in '/' Application.
HTTP Error 400 - Bad Request.
Version Information: ASP.NET Development Server 10.0.0.0 

4 个解决方案

#1


3  

As part of the URI Specification (section 5.2, "relative resolution"), dots are always removed from the URI and used to specify relative paths. The double-dot .. refers to the parent path.

作为URI规范(第5.2节“相对分辨率”)的一部分,始终从URI中删除点并用于指定相对路径。双点..指的是父路径。

It's technically an invalid URI because these relative path tokens need to be followed by a path separator, i.e. the /. In your case, it's being followed by the text hi, which doesn't conform to the specification and comes back as a "bad request."

它在技术上是一个无效的URI,因为这些相对路径令牌需要跟一个路径分隔符,即/。在你的情况下,它后面是文本hi,它不符合规范,并作为“错误请求”返回。

#2


2  

".." denotes "parent directory" when referencing a file. "." denotes the current directory.

“..”表示引用文件时的“父目录”。 “”表示当前目录。

If you try to name it ..XXX, it assumes you're giving it a relative file path, and it looks in the parent directory.

如果您尝试将其命名为..XXX,它会假定您为其提供了相对文件路径,并且它在父目录中查找。

#3


1  

Are you talking about the file name ..? Well the problem with that is that .. refers to the parent directory which is a bad thing to access from a URL.

你在谈论文件名吗?那么问题就是..指的是父目录,这是从URL访问的坏事。

#4


0  

Probably because .. is also the file name of the parent folder. The server is interpreting the request as the parent folder then hi.

可能是因为..也是父文件夹的文件名。服务器将请求解释为父文件夹,然后是hi。

#1


3  

As part of the URI Specification (section 5.2, "relative resolution"), dots are always removed from the URI and used to specify relative paths. The double-dot .. refers to the parent path.

作为URI规范(第5.2节“相对分辨率”)的一部分,始终从URI中删除点并用于指定相对路径。双点..指的是父路径。

It's technically an invalid URI because these relative path tokens need to be followed by a path separator, i.e. the /. In your case, it's being followed by the text hi, which doesn't conform to the specification and comes back as a "bad request."

它在技术上是一个无效的URI,因为这些相对路径令牌需要跟一个路径分隔符,即/。在你的情况下,它后面是文本hi,它不符合规范,并作为“错误请求”返回。

#2


2  

".." denotes "parent directory" when referencing a file. "." denotes the current directory.

“..”表示引用文件时的“父目录”。 “”表示当前目录。

If you try to name it ..XXX, it assumes you're giving it a relative file path, and it looks in the parent directory.

如果您尝试将其命名为..XXX,它会假定您为其提供了相对文件路径,并且它在父目录中查找。

#3


1  

Are you talking about the file name ..? Well the problem with that is that .. refers to the parent directory which is a bad thing to access from a URL.

你在谈论文件名吗?那么问题就是..指的是父目录,这是从URL访问的坏事。

#4


0  

Probably because .. is also the file name of the parent folder. The server is interpreting the request as the parent folder then hi.

可能是因为..也是父文件夹的文件名。服务器将请求解释为父文件夹,然后是hi。