使用用户名和密码进行Webclient身份验证 [英] Webclient authentication with username and password

查看:449
本文介绍了使用用户名和密码进行Webclient身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用我没有开发的网页验证登录信息,当我在浏览器中打开网页时 - Chrome-它会弹出一个与Chrome相关的灰色小屏幕,要求输入用户名和密码,我不知道是什么是这种身份验证方法被称为基本或cookie或形式,我不知道所以请让我知道,我也可以如何使用webclient提供此类身份验证,我尝试使用凭据,但没有希望。

解决方案

可悲的是,答案并不是那么简单,除了说:它不是一个cookie。



网页_probably_使用基本的身份验证,但可以使用其他形式。



就向webclient提供身份验证信息而言,您忽略了提到您正在编程的语言。



如果您使用的是.NET语言,这篇文章可能会回答您的问题: HTTP G.使用.NET WebClient的ET [ ^ ]。



如果你需要更多关于WebClient的血腥细节,这里是 WebClient上的MSDN页面 [ ^ ]。即便如此,您可能需要在创建Credentials时提供更多详细信息以提供WebClient,这在添加到CredentialsCache的MSDN页面 [ ^ $。



[更新:]通常,在初始身份验证后,服务器将发回一个带有SESSION ID NUMBER的cookie。在同一会话中,来自同一浏览器的每个进一步页面访问将发送此会话ID cookie,因此服务器知道该访问已经过身份验证。



-Jesse

im trying to verify login information using a webpage which i didn''t develop , when i open the webpage in the browser - Chrome- it popups a gray small screen related to Chrome asking for username and password , i do not what is this authentication method called is it Basic or cookie or form i can not know so please let me know , also how i can provide such authentication using webclient ,i tried using credentials but with no hope.

解决方案

Sadly, the answer isn''t so simple, except to say: it is not a cookie.

The webpage _probably_ uses "Basic" authentication, but may use other forms.

As far as providing authentication information to webclient, you neglected to mention which language you are programming in.

Here is an article that may answer your question if you are using a .NET language: HTTP GET with .NET WebClient[^].

And if you need more gory details on WebClient, here is the MSDN page on WebClient[^]. Even so, you may need to provide more details when you create your Credentials to give your WebClient, which is discussed on this MSDN page on adding to the CredentialsCache[^].

[UPDATE:] Often, after initial authentication, the server will send back a cookie with a SESSION ID NUMBER. Each further page access from the same browser, in the same session, will send this session ID cookie, so the server knows the access is already authenticated.

-Jesse


这篇关于使用用户名和密码进行Webclient身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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