If you have very specific requirements, I strongly suggest you use WebClient over WebRequest . This will handle a lot of things automatically for you and it will be better (in most cases) to manage memory.
eg. most of your code above can be replaced with DownloadStringAsync
Otherwise, your code looks great. In fact, I executed it in the MonoTouch application, and it starts without problems (after replacing GetUrl ) and the called call .
However, your comments, not your code, make me wonder if the network call is called in different ways, but is not justified. eg.
// Show temp value here.
An asynchronous callback will be called in another thread. UIKit, like most existing UI tools, requires that all operations related to the user interface be performed in the main thread (UI). Not doing this will give you a lot of pain.
You can ensure that UI (or other) code is executed in the main thread (UI) using InvokeOnMainThread . See the article for more details.
source share