How can I get a reference to an HttpResponse in ASP.NET MVC?

后端 未结 3 1558
后悔当初
后悔当初 2021-02-03 22:40

I\'m calling a third-party library that takes a System.Web.HttpResponse. I see I have a HttpResponseBase, but not HttpResponse like in web

3条回答
  •  不思量自难忘°
    2021-02-03 23:17

    If you need to interact with systems which take the non-mockable types, you can get access to the current HttpContext via the static property System.Web.HttpContext.Current. The HttpResponse is just hanging off of there via the Response property.

提交回复
热议问题