从PathAndQuery末尾删除的期间 [英] Period Dropped from End of PathAndQuery

查看:72
本文介绍了从PathAndQuery末尾删除的期间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Web应用程序,以查找有关汽车的年份,品牌和型号的信息.我想检测传递给服务器的URL是否为

http://server.com/Vehicles/2004/Honda/Civic DX 2 and 4 Dr.

(我没有在上面加上%20",因为我们可以理解该URL将被正确地编码/解码,并且我们不需要对此感到厌烦)

因此,在Global.asax.cs文件中,我获得了Request.Url.PathAndQuery的值来确定是否传递了这样的URL.唯一的事情是,当我将此URL传递到服务器时,事情并非如此,并不是所有的汽车型号都以句点结尾,所以我不知道一个先验哪个有周期,哪些没有周期.

Request.Url.PathAndQuery在URL的末尾删除末尾的``''是正常的吗?如果是这样,我是否可以访问Request的另一个属性以获得完整的URL,句点和所有内容?

I am writing a web application to look up information about year, make, and model of cars. I want to detect if the URL passed to the server is

http://server.com/Vehicles/2004/Honda/Civic DX 2 and 4 Dr.

(I am not putting the ''%20'' in the above because we can understand that the URL will be properly encoded/decoded and we don''t need to belabor that)

So, in the Global.asax.cs file, I get the value of Request.Url.PathAndQuery to determine whether a URL like this is passed. Only thing is, when I pass this URL to the server and I Thing is, not all car models end with a period, so I cannot know a priori which ones have periods and which do not.

Is this normal for Request.Url.PathAndQuery to drop the ending ''.'' on the end of a URL? If so, is there another property of Request that I can access in order to get the whole URL, period and all?

推荐答案

我猜PathAndQuery假定"Civic DX 2和4 Dr."部分是文件名.在这种情况下,它会删除句点,因为它不会被视为文件名的一部分,而是扩展名.
I''m guessing that the PathAndQuery is assuming that the "Civic DX 2 and 4 Dr." part is a filename. In this case it is dropping the period because it wouldn''t be considered part of the filename, but rather the extension.


这篇关于从PathAndQuery末尾删除的期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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