我一直在尝试使用c#和HtmlAgilityPack访问该网站,查找最新版本及其工件。我目前被困在登录,我想我只需要发送会话Cookies。
我走的方向对吗?还有人试过吗?
我意识到用构建脚本推出文件很容易,但我希望尽量减少对Ant、NAnt文件的更改,因为我正在考虑将其扩展到100个应用程序。
这个问题看起来很有希望
Getting HTML from a page behind a login
现在可以了,我只需要写一些代码来解析它
WebClient ww = new WebClient();
ww.Credentials = CredentialCache.DefaultCredentials;
ww.DownloadString("http://yourteamcity.com/login.html");
ww.Headers.Add("Cookie",ww.ResponseHeaders["Set-Cookie"]);
NameValueCollection post = new NameValueCollection();
post.Add("username", "name");
post.Add("remember","true");
post.Add("submitLogin", "Login");
post.Add("publicKey","long thing to intercept with fiddler");
post.Add("encryptedPassword","not giving you this");
post.Add("_", "");
byte[] values = ww.UploadValues("http://yourteamcity.com/loginSubmit.html", "POST",post);
string s = ww.DownloadString("http://yourteamcity.com/overview.html");