home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
Submit: code patches (MediaPortal/TV-Server/etc.)
Utils: DownLoadImage failed when PageRequest need Header "User-Agent"
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="morfius" data-source="post: 1098788" data-attributes="member: 116650"><p>I regret very much the delay. Finally, i think found a elegant solution, without "if" and working at least for this two webs. (I guess that this solution work for all webs).</p><p></p><p>[code] public static void DownLoadImage(string strURL, string strFile)</p><p> try</p><p> {</p><p> HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(strURL);</p><p> wr.Timeout = 20000;</p><p>...</p><p>[/code]</p><p><strong></strong></p><p><strong>PATCH</strong></p><p><strong></strong></p><p>[code] public static void DownLoadImage(string strURL, string strFile)</p><p> try</p><p> {</p><p> HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(strURL);</p><p> wr.Timeout = 20000;</p><p></p><p> //Set UserAgent = "Any UserAgent"</p><p> wr.UserAgent = "Mozilla/8.0 (compatible; MSIE 9.0; Windows NT 6.1; .NET CLR 1.0.3705;)";</p><p></p><p> //Accept All</p><p> wr.Accept = "*/*";</p><p>...</p><p>[/code]</p><p>With this two lines, this code works fine for me No need for set any other header, like language, etc.</p><p></p><p><em></em></p><p><em>Additional Observation</em></p><p><em></em></p><p>This old procedure entry uses WebClient, but i think is not used anymore. (from 1.9)</p><p>[code]</p><p> public static void DownLoadImage(string strURL, string strFile, System.Drawing.Imaging.ImageFormat imageFormat)</p><p>[/code]</p><p></p><p>Greetings from Spain!!!</p></blockquote><p></p>
[QUOTE="morfius, post: 1098788, member: 116650"] I regret very much the delay. Finally, i think found a elegant solution, without "if" and working at least for this two webs. (I guess that this solution work for all webs). [code] public static void DownLoadImage(string strURL, string strFile) try { HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(strURL); wr.Timeout = 20000; ... [/code] [B] PATCH [/B] [code] public static void DownLoadImage(string strURL, string strFile) try { HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(strURL); wr.Timeout = 20000; //Set UserAgent = "Any UserAgent" wr.UserAgent = "Mozilla/8.0 (compatible; MSIE 9.0; Windows NT 6.1; .NET CLR 1.0.3705;)"; //Accept All wr.Accept = "*/*"; ... [/code] With this two lines, this code works fine for me No need for set any other header, like language, etc. [I] Additional Observation [/I] This old procedure entry uses WebClient, but i think is not used anymore. (from 1.9) [code] public static void DownLoadImage(string strURL, string strFile, System.Drawing.Imaging.ImageFormat imageFormat) [/code] Greetings from Spain!!! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Submit: code patches (MediaPortal/TV-Server/etc.)
Utils: DownLoadImage failed when PageRequest need Header "User-Agent"
Contact us
RSS
Top
Bottom