Problem with a URL that ends with

前端 未结 4 774
甜味超标
甜味超标 2020-12-16 14:59

I have a big problem. There are devices in live that send the URL \"/updates \". It\'s a typo of the developer for those devices. In the server logs, it looks like \"/upd

4条回答
  •  囚心锁ツ
    2020-12-16 15:37

    According to some, this is in System.Web.dll:

    internal static void CheckSuspiciousPhysicalPath(string physicalPath)
    {
      if (((physicalPath != null) && (physicalPath.Length > 0))
        && (Path.GetFullPath(physicalPath) != physicalPath))
      {
        throw new HttpException(0x194, "");
      }
    }
    

    I guess you cannot change that, but can't one disable it in the IIS settings? Of course, that would also disable all other checks... :-(

    Or write some ISAPI filter that runs before the above code? Writing your own module is said to be easy, according to Handle URI hacking gracefully in ASP.NET.

    Or, create your own error page. In this page (like suggested in the URI hacking link above) search for specific text in exception.TargetSite.Name, such as CheckSuspiciousPhysicalPath and if found (or simply always) look at current.Request.RawUrl or something like that, clear the error and redirect to a repaired URL?

提交回复
热议问题