c# - How not following the location in headers using Web Client class? -
c# - How not following the location in headers using Web Client class? -
is possible on web client class? like
mywebclient.allowautoredirect = false; (of httpwebrequest)
you write custom web client , enable functionality:
public class webclientex : webclient { protected override webrequest getwebrequest(uri address) { var request = (httpwebrequest)base.getwebrequest(address); request.allowautoredirect = false; homecoming request; } }
and then:
using (var client = new webclientex()) { console.writeline(client.downloadstring("http://google.com")); }
c# .net header location webclient
Comments
Post a Comment