Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想实现一些在 HTTP 状态代码为 404 时不会引发异常的东西。我可以使用System.Web.WebRequest类还是必须使用较低的 API?(我不能先发送 HTTP HEAD 请求,因为有些服务器会忽略它们。)
System.Web.WebRequest
还有另一个 API。它是System.Net.Http.HttpClient。对于低于 4.5 的 .NET,需要System.Net.Http NuGet 包。