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

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -