
11.04.2008, 11:32
|
|
Постоянный
Регистрация: 16.04.2007
Сообщений: 398
С нами:
10037186
Репутация:
1462
|
|
Managed , для ленивых )
Код:
using System.Net;
using System.Collections.Specialized;
...
WebClient wc = new WebClient();
NetworkCredential nc = new NetworkCredential("usr", "mypassword");
wc.Credentials = nc;
byte[] response = wc.DownloadData("http://localhost/testlogin");
Console.WriteLine(Encoding.ASCII.GetString(response));
а чтоб сохранять сессию , добавляй
CookieContainer cookies = new CookieContainer();
Request.CookieContainer = cookies;
... и после каждого перехода обновляй контейнер
cookies = Request.CookieContainer;
|
|
|