陈斌彬的技术博客

Stay foolish,stay hungry

C#,WebRequest类和HttpWebRequest类的区别?

httpWebRequest是webRequest的子类,httpWebRequest是基于http协议的 .

HttpWebRequest 是 WebRequest 的实例化使用,单独的 WebRequest 是不能使用的

在使用HttpWebRequest实例,我们不用使用HttpWebRequest类的构造函数,而是使用WebRequest类提供的静态方法,然后强制转换,如:

HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();