c#:System.Web.HttpResponse类在Intellisense中不可用 [英] c#: System.Web.HttpResponse class not available in intellisense
问题描述
因此,我正在C#Visual Studio 2013中编写一个程序.在我的代码顶部(包括用法),我有:
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;
然后Intellisense说,尽管根据该页面HttpResponse是System.Web命名空间的一部分,但实际上没有HttpResponse类:
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
此外,对于我可以导入的其他东西(使该类可用),它没有任何选择.我在这里做错了什么?不推荐使用HttpResponse吗?如果是,是否有其他方法来获取http响应的状态代码.
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.
推荐答案
有多个具有名称空间System.Web的dll,例如System.Web.Entity.您需要添加对基本System.Web dll的引用,它应该可以工作.
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.
这篇关于c#:System.Web.HttpResponse类在Intellisense中不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!