Is there an easier way to write this? I know if i didnt need cookies i could have done
var sz = new WebClient().DownloadString(url);
But i need cookies bc of login data so i am stuck with this instead. Is there a way to make it short like the line above?
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.CookieContainer = cookie;
string sz;
using (var r = request.GetResponse().GetResponseStream())
{
using(var r2 = (TextReader)new StreamReader(r))
{
sz= r2.ReadToEnd();
}
}