Author: WilliamSnell | Posted on: 9/29/2009 1:51:34 PM | Views : 276

 I'm a little confused about the security issues when downloading files from a server programmatically. If I try to download a file from my website via code using something like this:
string url = "http://www.mysite.com/somefolder/somefile"; WebClient client = new WebClient(); byte[] byteArray = client.DownloadData(url); // client.DownloadFile(url, @"E:\My Documents\C# in Depth.pdf"); // Stream stream = client.OpenRead(url);
I get a 403 Forbidden error using this code. That would be ok, since I haven't provided any credentials, except that I can take the exact same url and just paste it into any browser, and the file is served up without error. If it's not a security issue to serve up the file in a browser without credentials, why does attempting to download the file with the same url result in an error?
...

Go to the complete details ...