本文介绍了我怎样才能在ASP.NET MVC的Htt的presponse的参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打电话第​​三方库,需要一个 System.Web.Htt presponse 。我看到我有一个的Htt presponseBase ,而不是的Htt presponse 像Web窗体。

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 forms.

有没有办法让的Htt presponse ?使用 MVC 3


我试图做到这一点的控制器方法。还纠正外壳。

:I'm trying to do this in a controller method. Also corrected casing.

推荐答案

如果您需要与内搭的非mockable类型的系统进行交互,你可以通过静态属性访问当前HttpContext 的System.Web .HttpContext.Current 。该型Htt presponse只是挂那里通过响应属性。

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.

这篇关于我怎样才能在ASP.NET MVC的Htt的presponse的参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:32