c#: System.Web.HttpResponse class not available in intellisense

房东的猫 提交于 2019-12-14 03:52:18

问题


So I'm writing a program in C# Visual Studio 2013. At the top of my code, among my usings, I have:

using System.Web;

But when I try to use the line:

 HttpResponse httpResp = (HttpResponse)response;

then Intellisense says there is no HttpResponse class, in spite of the fact that HttpResponse is part of the System.Web namespace according to this page: https://msdn.microsoft.com/en-us/library/system.web.httpresponse(v=vs.110).aspx

Furthermore it doesn't give me any options as to what else I could import that would make that class available. What am I doing wrong here? Is HttpResponse deprecated? If it is, is there a different way to get the status code of an http response.


回答1:


There are multiple dll's that have the namespace System.Web, such as System.Web.Entity. You need to Add Reference to the base System.Web dll and it should work.




回答2:


Check your project references, you're probably missing Syetem.web.



来源:https://stackoverflow.com/questions/36091629/c-system-web-httpresponse-class-not-available-in-intellisense

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!