I would like to set a timeout value for httpwebrequest in my C# WinRT code. But httpwebrequest is not available in WinRT. so how please let me know how to set the timeout value for the HttpWebRequest.
2 Answers
Use the HttpClient class to make your request. It has a TimeOut property you can set to your liking.
You can also use the HttpWebRequest class, and it also have a TimeOut property.
In most cases, HttpClient is the way to go, as it is easier to use and you don't need the level of customization the HttpWebRequest provides.
2 Comments
Mugu
so you mean to say that there is no way to set timeout if I use HttpWebRequest ?
Falanwe
I'm sorry, i took for granted your affirmation that "httpwebrequest is not available in WinRT". Turns out it is available. I edited my answer accordingly. Anyway, in most cases, use HttpClient: it's far easier to use and can make multiple requests if need be.