WebRequest is an abstract class, which has a factory method Create that, depending on the URL passed in, creates an instance of a concrete subclass. Whether you need or want
HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(strUrl); instead of
WebRequest req = WebRequest.Create(strUrl); depends on your needs, and on what kind of URLs you pass in.
If you only pass in HTTP: URL's, then the former code allows you to access the properties and methods the subclass HttpWebRequest implements in addition to those defined on the base class WebRequest. But if you passed in a FTP: URL then the attempt to cast to HttpWebRequest would fail.
The latter is generic and won't fail on any of the types of supported URL's but of course without casting to any subclass you can only access the properties and methods the base class defines.
-- via Martin Honnen