Re: WebRequest problems
From: Michael Kremser (moc.NOTUSEABLE.unyd.taerg_at_nuj4002pxe)
Date: 06/04/04
- Next message: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Previous message: Chris Tacke, eMVP: "Re: Remove button border"
- In reply to: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Next in thread: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Reply: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 04 Jun 2004 14:01:13 +0200
Jon Skeet [C# MVP] wrote:
Hi Jon,
Thank you for your answer!
>>HttpServiceAdapter.cs(50): Cannot implicitly convert type
>>'System.Net.WebResponse' to 'System.IDisposable'
>
>
> Ah yes - for some reason it doesn't seem to implement IDisposable in
> the Compact Framework. You need to call Close() on it, in a finally
> block.
I can't see it's implementing IDisposable at all, at least there's no
method "Dispose" also in the "big" fx.
> That *should* fix the problem, I believe. (I had a very similar bug a
> while ago.)
I now close the stream as well as the response, as shown below:
WebRequest req = WebRequest.Create(strURL);
WebResponse resp = req.GetResponse();
using (StreamReader reader = new StreamReader
(resp.GetResponseStream(), System.Text.Encoding.UTF7))
{
strResult = reader.ReadToEnd();
reader.Close();
}
resp.Close();
...but there's still the same error. :-( I begin to wonder whether we
work with a beta release of CF... :-/
However, in another thread on this NG I found a link where a download of
a file is being described:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/AutoUpdater.asp
I try this out and hope it helps. If not, I thought to just catch but
ignore this exception (currently the user would get annoyed by a dialog
box saying that the transfer failed - I will make a routine around the
call that tries it maximum three times automatically if the problem
persists).
Best regards,
Michael
-- How to contact me ~~~~~~~~~~~~~~~~~ directly via mail: remove the "NOTUSEABLE" and the point after it and reverse the characters via my portal: go to http://great.dynu.com/tools/contact.4s?lang=de&ref=usenet
- Next message: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Previous message: Chris Tacke, eMVP: "Re: Remove button border"
- In reply to: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Next in thread: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Reply: Jon Skeet [C# MVP]: "Re: WebRequest problems"
- Messages sorted by: [ date ] [ thread ]