tags:

views:

223

answers:

2

I am downloading files with the WebClient class in .NET 3.5. I would like to be sure that on the server side, the files requested appear to be downloaded with a IE client. What do I have to change exactly?

Do I have simply to copy the header information generated by IE to the Header property of the WebClient object? Is there anything else I need to do?

Thanks

+1  A: 

Depending on your needs, just setting the user agent header might be enough. There is an example at http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx

Sinan Ünür
A: 

The short answer is yes.

The following code provides the complete header information, Just run it in the browser zou want and you will the settings you should done.

<html>
<body>

<script type="text/javascript">
var x = navigator;
document.write("CodeName=" + x.appCodeName);
document.write("<br />");
document.write("MinorVersion=" + x.appMinorVersion);
document.write("<br />");
document.write("Name=" + x.appName);
document.write("<br />");
document.write("Version=" + x.appVersion);
document.write("<br />");
document.write("CookieEnabled=" + x.cookieEnabled);
document.write("<br />");
document.write("CPUClass=" + x.cpuClass);
document.write("<br />");
document.write("OnLine=" + x.onLine);
document.write("<br />");
document.write("Platform=" + x.platform);
document.write("<br />");
document.write("UA=" + x.userAgent);
document.write("<br />");
document.write("BrowserLanguage=" + x.browserLanguage);
document.write("<br />");
document.write("SystemLanguage=" + x.systemLanguage);
document.write("<br />");
document.write("UserLanguage=" + x.userLanguage);
</script>

</body>
</html>
Luixv