Equivalent of java.net.URLConnection in .NET -
is there equivalent of java.net.urlconnection class in .net. , example httpwebrequest? else used?
probably closest is:
webrequest req = webrequest.create(url); // note idisposable // should in "using" block, or // otherwise disposed. since handle multiple protocols etc. if meaning http - i'd use webclient; simpler httpwebrequest (one of webrequest implementations).
if want download page:
string s; using(var client = new webclient()) { s = client.downloadstring(url); }
Comments
Post a Comment