c# - Downloading a file from a redirection page -


how go downloading file redirection page (which calculations based on user).

for example, if wanted user download game, use webclient , like:

client.downloadfile("http://game-side.com/downloadfetch/"); 

it's not simple doing

client.downloadfile("http://game-side.com/download.exe"); 

but if user click on first one, redirect , download it.

i think, should go customized webclient class that. follow code 300 redirects:

public class mywebclient : webclient {     protected override webresponse getwebresponse(webrequest request)     {         (request httpwebrequest).allowautoredirect = true;         webresponse response = base.getwebresponse(request);         return response;     } } ... webclient client=new mywebclient(); client.downloadfile("http://game-side.com/downloadfetch/", "download.zip"); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -