IIS treats double-encoded forward slashes in URLs differently on the first request than it does on subsequent requests

后端 未结 2 799
花落未央
花落未央 2021-01-05 17:33

Recently my team was asked to implement an HttpModule for an ASP.NET MVC application that handled double-encoded URLs on IIS 7 and .NET 3.5. Here\'s the crux of the problem

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 18:11

    This really isn't an answer, but possibly a step in the right direction. I haven't had time to create a test harness to prove anything.

    I followed this.PrivateAbsolutePath through Reflector and it goes on and on. There is a lot of string manipulation when it's accessed.

    public string AbsolutePath
    {
        get
        {
            if (this.IsNotAbsoluteUri)
            {
                throw new InvalidOperationException(SR.GetString("net_uri_NotAbsolute"));
            }
            string privateAbsolutePath = this.PrivateAbsolutePath; //HERE
            if (this.IsDosPath && (privateAbsolutePath[0] == '/'))
            {
                privateAbsolutePath = privateAbsolutePath.Substring(1); 
            }
            return privateAbsolutePath;
        }
    }
    

提交回复
热议问题