开发者

Login users on xbox.com using ASP.NET WebClient?

开发者 https://www.devze.com 2023-02-03 23:53 出处:网络
I was wondering how I could allow users to login to xbox.com using the WebClient class. I\'ve got the following code so far, but I get an incorrect password/user combination error.

I was wondering how I could allow users to login to xbox.com using the WebClient class. I've got the following code so far, but I get an incorrect password/user combination error.

NameValueCollection formData = new NameValueCollection();
        formData["login"] = "username";
        formData["passwd"] = "pass";

        string url = "https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct=1294985876&rver=6.0.52开发者_JAVA技巧86.0&wp=MBI&wreply=https://live.xbox.com:443/xweb/live/passport/setCookies.ashx%3Frru%3Dhttp%253a%252f%252fwww.xbox.com%252fen-US%252f&lc=1033&cb=reason%3D0%26returnUrl%3Dhttp%253a%252f%252fwww.xbox.com%252fen-US%252f&id=66262&bk=1294986379";
        WebClient webClient = new WebClient();
        byte[] responseBytes = webClient.UploadValues(url, "POST", formData);
        string response = Encoding.UTF8.GetString(responseBytes);

       Response.Write(response);

Do I need to execute some javascript to authenticate the user? Also, please let me know how I should handle cookies. I'm not familiar with CookieContainers. Thanks much.


I had an implementation of an Xbox.com login script working in C# and ASP.NET MVC for a while, but it recently stopped working after the latest Xbox.com update. I'm now using PHP and cURL to perform the scraping and I'm persisting the data to Neo4j using Neo4jPHP where I can access it from C# using Neo4jClient. It's a bit of a convoluted method, but it works for the time being until I can get my C# client working again. The trick is to appropriately send/receive cookies from the server so that session information is kept between requests.

0

精彩评论

暂无评论...
验证码 换一张
取 消