[英]Does ASP .NET c# HttpWebRequest support HTTPS Authentication via username:password@www.website.com?
As the title says, 正如标题所说,
Does ASP .NET c# HttpWebRequest support HTTPS Authentication via username:password@www.website.com? ASP .NET c#HttpWebRequest是否支持通过用户名验证HTTPS验证:password@www.website.com?
Almost everything I find regarding authentication appends the username and password after the website. 几乎我发现的有关身份验证的所有内容都会在网站后添加用户名和密码。 Will using System.Net.HttpRequest work with username and password before the website? 使用System.Net.HttpRequest会在网站之前使用用户名和密码吗?
[EDIT] [编辑]
Let me explain the scenario, this is for an application that I am developing that makes a HTTP POST to a website. 让我解释一下这个场景,这是针对我正在开发的一个应用程序,它对网站进行HTTP POST。 We are already using HTTPS, and the website server has my IP whielisted. 我们已经在使用HTTPS了,网站服务器的IP已经过了。 At the request of someone from the 'website', they want to use the username:password@www.website.com in addition for authentication. 应“网站”某人的要求,他们希望使用用户名:password@www.website.com进行身份验证。
Adding credentials on the url never worked for me. 在网址上添加凭据从来没有对我有用。 This is how I'm currently doing it: 这就是我目前正在做的事情:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
System.Net.CredentialCache credentialCache = new System.Net.CredentialCache();
credentialCache.Add(
new System.Uri(apiUrl),
"Basic",
new System.Net.NetworkCredential(basicAuthUserName, basicAuthPassword)
);
request.PreAuthenticate = true;
request.Credentials = credentialCache;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.