I am trying to query the version info off of TeamCity. I can do it simple enough via Internet Explorer:
It simply returns:
But what I'd like to do is this same action via C#. Here's what I have so far:
const string PATH = "http://...";
using (var wc = new WebClient())
string result = wc.DownloadString(PATH)
This won't work because the result I get back is the HTML requesting that I log in.
Ok, I think it wants me to send credentials. So before the call to download the string, I added:
wc.Credentials = new NetworkCredential("<userid>", "<password>");
I use my Team City userid/password, but I'm still getting the login html.
What I think IE does is that it passes it's "RememberMe" cookie, which substitutes as the necessary credentials.
Can someone provide me the necessary code to make the authentication happy?
Thanks in advance,