我正在使用ASP.NET Framework 4.8构建Web应用程序,并且在创建自己的响应类别时,我正在尝试自定义对客户的响应。
我一直在寻找如何实施它,我意识到有两个类别处理请求和响应的类是httpcontext.Response。他们?
I´m building a web application using asp.net Framework 4.8 and I´m trying to customize the response to the client when there´s an exception by creating my own Response class.
I was looking about how to implement it and I realized that there are two classes that handle the requests and responses, one of them was HttpContext.Response whose type is HttpResponse and the other was HttpResponseMessage so I was wondering, What´s the difference between them?
发布评论
评论(1)
由于它们是两个完全不同的类别,因此不能太容易地总结一下:
通过快速查看其属性,您可以获得一些想法。
httpresponse
https://学习。 microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-6.0
That can't be too easily summarized since they are two completely different classes:
You can get a bit of an idea by a quick look at their properties.
HttpResponse
https://learn.microsoft.com/en-us/dotnet/api/system.web.httpresponse?view=netframework-4.8
HttpResponseMessage
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage?view=net-6.0