C# File download does not start when invoke or execute a url

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
if anyone load this url Model Download Links into browser then a excel file start download. so when i invoke the same url by HttpWebRequest then excel file does not start download. this code example i tried.

string address = "Model Download Links";
using (WebClient client = new WebClient())
{
client.DownloadString(address);
}
again i tried this one too.

string url = "Model Download Links";
WebRequest request = HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseText = reader.ReadToEnd();
but failed to reach my goal. code successfully executed but no excel file start downloading which i am trying to achieve.

when i tried to load this url Model Download Links into webbrowser control then also saw same problem no excel file start download. here is code which i tried.

webBrowser1.Navigate("Model Download Links");
webBrowser1.ScriptErrorsSuppressed = true;
i just do not understand why excel file is not getting download when invoke or execute the same very url.

so please some one tell me what i need to do as a result the moment i will execute the url excel file will start downloading in client pc.

please share some working code example. thanks

Continue reading...
 

Similar threads

Back
Top