简体   繁体   English

ASP .NET c#HttpWebRequest是否支持通过用户名验证HTTPS验证:password@www.website.com?

[英]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.

相关问题 在 C# 中通过 HttpWebRequest 实现 Digest 身份验证 - Implement Digest authentication via HttpWebRequest in C# ASP.NET C#验证用户名和密码 - ASP.NET C# Validating username and password 无论如何我们可以使用用户名和密码对 dev.azure.com 进行身份验证并创建和更新错误 (C# Asp.net)? - Is there anyway we can authenticate to dev.azure.com using username and password and create and update bugs (C# Asp.net)? 在C#中使用https进行HttpWebRequest - HttpWebRequest with https in C# 为什么使用“新的NetworkCredential(用户名,密码)”不适用于我的网站的基本身份验证(来自WinForms C#应用程序)? - why is use of “new NetworkCredential(username, password)” not working for Basic Authentication to my website (from a WinForms C# app)? 如何在c#中验证网站的密码和用户名 - How to validate Password and Username for website in c# 在表单身份验证ASP.NET C#中重置用户密码 - Resetting users password in forms authentication asp.net C# ASP.net网站中的C#密码TextBox - C# password TextBox in a ASP.net website 如何在 C# 中使用 HttpWebRequest 和 HttpWebResponse 从“https://www.scopus.com/author/highchart.uri?authorId=7103216110”Url 获取 Json 值 - How to get Json value from "https://www.scopus.com/author/highchart.uri?authorId=7103216110" Url With HttpWebRequest and HttpWebResponse In C# C#HttpWebRequest到HTTPS失败 - C# HttpWebRequest to a HTTPS failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM