|
本帖最后由 2949497060 于 2015-9-19 10:23 编辑
我用httphelper要弄个tplink无线路由器的自动重启功能,要通过设置ICredentials,帐密都是“admin”,请问怎么写?附上没有用的代码:
string lyqCqUrl = "http://192.168.1.1/userRpm/SysRebootRpm.htm?Reboot=%D6%D8%C6%F4%C2%B7%D3%C9%C6%F7";
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(lyqCqUrl), "Basic", new NetworkCredential("admin", "admin"));
DotNet.Utilities.HttpItem itemRestartLyq = new DotNet.Utilities.HttpItem()
{
URL = lyqCqUrl,
Method = "GET",
Timeout = 5000,
Encoding = Encoding.GetEncoding("gb2312"),
ContentType = "application/x-www-form-urlencoded",
Referer = "http://192.168.1.1/userRpm/SysRebootRpm.htm",
ICredentials = myCache,
};
|
|