开发者

Why is a page starting with .. illegal?

开发者 https://www.devze.com 2022-12-26 02:49 出处:网络
I have a page called ..hi i get this error when visiting the page. Why is that illegal? Server Error in \'/\' Application.

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

Server Error in '/' Application.
HTTP Error 400 - Bad Request.
V开发者_C百科ersion Information: ASP.NET Development Server 10.0.0.0 


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.

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."


".." 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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消