如何使用用户名和密码访问服务器 [英] How can I access server using usingname and password

查看:172
本文介绍了如何使用用户名和密码访问服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有包含我的txt文件的文件服务器.

我尝试使用C#程序访问它,但无法访问.因为它需要登录名和密码.

如何在C#中输入此登录信息?

我尝试过的事情:

谷歌搜索
尝试一些代码示例.

Hello

I have file server which include my txt files.

I tried to c# program to access it but i cant access.Because it need loginname and password.

How can i enter this login infos in c#?

What I have tried:

google search
try some code sample

推荐答案

报价:

因为它需要登录名和密码.

Because it need loginname and password.

这意味着它要求您传递身份验证信息,以便服务器知道谁在尝试访问该服务.您应该将此信息传递给服务器,不仅是您的服务器,而且出于安全性,配额或任何其他目的,每个服务器都需要此身份验证模型.

通常,这在服务器的文档中提供,服务器显示连接的端点以及需要传递的标头(用户名和密码).在.NET Framework的网络中,您使用 NetworkCredential [ ^ ]对象,以传递有关身份验证的信息.

看看这个技巧,它解释了发送用户名和密码的概念(当然是一种不同的实现),因此请看一下 ^ ]

That means it requires you to pass the authentication information, so that server knows who is trying to access the service. You should pass this information to servers, it''s not just your server, but every server requires this authentication model, for security, quota or any other purposes.

Typically, this is provided in the documentation of your server, the server shows the endpoints where you connect and also the headers which you require to pass (username and password). In .NET framework''s networking you use NetworkCredential[^] object to pass the information about authentication.

Have a look at this tip, it explains the concept of sending the username and password (a different implementation, of course) so give it a look, Simple C# FTP Class[^]


这篇关于如何使用用户名和密码访问服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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