SilverlightShow: Windows Phone 7 Data Access Strategies: WebClient Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: Windows Phone 7 Data Access Strategies: WebClient <p>Hello,</p> <p>I'm trying to implement this (similar anyways) with google...and need to let google store cookies...but for some reason it is not jumping to the derived class (in your case 'ExtendedWebClient()') to allow cookies...am I missing something?  I'm doing it very similar to you...my code is:</p> <p style="padding-left: 20px; font-size: 80%;"><em> public WebClient InnerWebClient { get; set; }<br /> //.....//<br /> public MyWebClient()<br /> {<br /> this.InnerWebClient = new CookieWebClient();<br /> }<br /> //.....//<br /> this.InnerWebClient.UploadStringAsync(new Uri(url), verb, "");<br /> this.InnerWebClient.UploadStringCompleted += (sender, e) =><br /> {<br /> System.Diagnostics.Debug.WriteLine("Results from our webclient UPLOAD request! // " + e.Result.ToString());<br /> resultPreExecuteLogin = new Result(e.Result.ToString());<br /> };<br /> //.....//<br /> Here is my derived class....<br /> public class CookieWebClient : WebClient<br /> {<br /> public CookieContainer CookieContainer { get; private set; }<br /> <br /> [SecuritySafeCritical]<br /> public CookieWebClient()<br /> {<br /> this.CookieContainer = new CookieContainer();<br /> }<br /> <br /> protected override WebRequest GetWebRequest(Uri address)<br /> {<br /> WebRequest request = base.GetWebRequest(address);<br /> <br /> if (request is HttpWebRequest)<br /> (request as HttpWebRequest).CookieContainer = this.CookieContainer;<br /> <br /> return request;<br /> }<br /> }<br /> </em></p> <p>If you have any ideas, they would be greatly appreciated.  I've been banging my head on this for days now.</p> <p>Thanks.</p> http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment8581 iceman198 http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Fri, 02 Nov 2012 15:26:40 GMT Re: Windows Phone 7 Data Access Strategies: WebClient <p>Hi Andrea Boschin</p> <p>Your article is cool, but one problem I want receive string from a website using IP address(as Uri), I don't know the IP address,  So I am giving uri like this</p> <p>string IP = "10.0.0."</p> <p>isIPFound = false;</p> <p>GetStatus(){</p> <p> for (int i = 0; i < 20; i++)<br />            {<br />                uri = IP + i.ToString()+ "path";                </p> <p> client.DownloadStringAsync(new Uri(uri));                <br /> <br />  client.DownloadStringCompleted += newDownloadStringCompletedEventHandler(client_downloadStringCompleted);</p> <p> if (isIPFound)<br />                {</p> <p>                  isIPFound= false;<br />                    break;<br />                }</p> <p>}</p> <p><br /> </p> <p>client_downloadStringCompleted(s,e)</p> <p>{</p> <p>if (e.Error == null)<br />             {<br />                 isIPFound = true;<br />             }</p> <p>}</p> <p><br /> </p> <p>What I want is, It should keep changing the ip address untill maximum limit if ip found within the limit It should stop the operation and return the ip address.</p> <p>I am a student, working on my first windows phone app help me,</p> <p>Thanks</p> <p><br /> </p> <p>  </p> <p><br /> </p> http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment8571 AdarshUrs http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Fri, 26 Oct 2012 12:28:25 GMT Re: Windows Phone 7 Data Access Strategies: WebClient Thank you, you saved me. Your solution is wonderful, work like a charm. http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment8467 joysika http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Fri, 14 Sep 2012 11:59:36 GMT Re: Windows Phone 7 Data Access Strategies: WebClient Have you tryied the attached sample? http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment8170 AndreaBoschin http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Fri, 15 Jun 2012 16:24:57 GMT Re: Windows Phone 7 Data Access Strategies: WebClient <p>I have problems with the implementing of getwebrequest method, it says i can't access the method because of the protection level. Could you in more detail describe how to use the method?</p> http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment8169 BjrnHansson http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Fri, 15 Jun 2012 14:28:01 GMT Re: Windows Phone 7 Data Access Strategies: WebClient I'm happy to help! http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment7830 AndreaBoschin http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Thu, 12 Apr 2012 03:13:38 GMT Re: Windows Phone 7 Data Access Strategies: WebClient <p>Wow! Thank you! You just save me. I was going crazy, i couldn't find why this override of WebClient on WindowsPhone didn't work. It was keeping throw an exception.</p> <p>Your ExtendedWebClient works well :)</p> http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment7829 JrmyCorpinot http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Thu, 12 Apr 2012 02:36:32 GMT Re: Windows Phone 7 Data Access Strategies: WebClient Hey Now<a href="http://www.silverlightshow.net/Profile/AndreaBoschin.aspx" class="authorName" id="ctl00_cphMiddle_cphContent_modules_articles_article_ascx1_hlnkAuthor">Andrea Boschin</a><br /> <p> Nice post on Data w/ WP7! </p> http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx#comment6444 ccatto http://www.silverlightshow.net/items/Data-Access-Strategies-WebClient.aspx Thu, 18 Aug 2011 23:30:48 GMT