gpt4 book ai didi

ssl - HttpWebRequest SSL 授权表

转载 作者:太空宇宙 更新时间:2023-11-03 14:21:42 25 4
gpt4 key购买 nike

我以前从未尝试过,但现在我真的需要在 Sprint 的网站 (www.sprint.com) 上获得授权。

你们能帮我理解这实际上是如何工作的吗?

我正在尝试这样做,但显然我遗漏了一些东西。要么关于 cookies 或 ssl 或其他东西,我不知道。

  HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(
"https://sso.sprintpcs.com/sso/Login.do");
CookieContainer cookieContainer = new CookieContainer();
webRequest.CookieContainer = cookieContainer;
webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;
chromeframe; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729;
.NET CLR 3.0.30729; Tablet PC 2.0; .NET4.0C; .NET4.0E)";
webRequest.Accept = "image/jpeg, application/x-ms-application, image/gif, application/xaml+xml,
image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash,
application/vnd.ms-excel, application/msword, */*";

webRequest.Method = "POST";
webRequest.Host = "manage.sprintpcs.com";

string strUserId = "kindauser";
string strPass = "kindapass";

ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "userid=" + strUserId + "&password="
+ strPass + "&userExperince=USC allowlogin=false";

byte[] data = encoding.GetBytes(postData);
Stream requestStream = webRequest.GetRequestStream();
requestStream.Write(data,0,data.Length);

HttpWebResponse myHttpWebResponse = (HttpWebResponse)webRequest.GetResponse();

最佳答案

我会执行以下操作 - 这适用于您想要与网站进行交互的所有情况。

1) 获取 firefox,以及 firebug 扩展。2)清除firefox内容和cookie缓存3)使用 firefox 来做场景 - 登录网站,例如。4) 此时,firebug 会向您显示发送的请求的确切顺序以及 cookie header 等。

5) 现在尝试使用代码复制它。

关于ssl - HttpWebRequest SSL 授权表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2035709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com