如何使用C#使用HTTPS登录? [英] How to log in with HTTPS using C#?

查看:528
本文介绍了如何使用C#使用HTTPS登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能帮我登录到HTTPS页面并浏览该网站吗?例如,您是否可以帮助我登录Yahoo或Google或MSDN或任何HTTPS,获取必要的cookie,请求另一个页面,并得到一个响应,告诉我服务器已登录,所以我已经做了很多阅读关于此问题,但我需要一些真实的代码和一个不错的工作简单示例来开始学习.我已经做了很多谷歌搜索,所以请不要发布链接.如果您可以为我提供比链接更好的一行代码.

我已使用网络请求和网络响应来制作基本的网络抓取工具.因此,我可以基本获取页面.我似乎遇到的麻烦至少是这三个问题以及一般概念:
1.使用POST
2.存储/发送cookie
3.知道需要发送哪些请求和响应.

webrequest/webresponse类如何在C#中工作,以及确切地说我需要负责多少往返通信.例如,如果我获得了重定向或其他某种处理,我是否需要处理该重定向,或者它是为我自动处理的?

*我安装了提琴手,因此我可以在此计算机上看到HTTP I/O.我感到惊讶和感到惊讶的是,即使执行最琐碎的任务(例如访问Yahoo),HTTP通信的数量也会如此.

Can you help me log in to an HTTPS page and navigate about the site. For example, can you help me log in to Yahoo or Google or MSDN or anything HTTPS, get the necessary cookies, request another page, and get a response that tells me the server has me as logged in. I have done a lot of reading about this but I need some real code and a decent working simple example to get me started. I have done a lot of googling so no link posting please. If you can provide me with one line of code that is better than a link.

I have used web requests and web responses to make a basic web scraper. So I can do basic getting a page. What I seem to be having trouble with are at least these three issues PLUS the general concept:
1. using POST
2. storing/sending cookies
3. knowing which requests and responses need to be sent.

How the webrequest/webresponse classes work in C# and exactly how much of the back and forth communication I need to be responsible for. For example, if I get a redirect or something do I need to handle that or is it handled automatically for me?

*I have fiddler installed so I can see HTTP I/O on this computer. One thing that I am amazed and intimated by is the volume of HTTP communication that goes on when doing even the most trivial tasks like visiting Yahoo.

推荐答案

还没有答案吗?

谁能提供任何信息?它不一定是完整的综合教程.感谢您的帮助.
no answers yet?

Can anyone provide any information at all? It doesn''t have to be a complete comprehensive tutorial. Any help is appreciated.


首先,请耐心等待!
您可能想在以下位置查看msdn论坛: http://msdn. microsoft.com/en-us/library/aa752085(v=vs.85).aspx [
First, be patient!
you might want to check out the msdn forum at : http://msdn.microsoft.com/en-us/library/aa752085(v=vs.85).aspx[^]


这篇关于如何使用C#使用HTTPS登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆