gpt4 book ai didi

asp.net - 使用 RestSharp 请求带有 Windows 身份验证的 URL

转载 作者:行者123 更新时间:2023-12-03 17:34:42 24 4
gpt4 key购买 nike

我在 IIS 中有一个网站,其身份验证模式设置为 Windows .
我需要使用 restsharp 调用该站点中的 URL :

var client = new RestClient(item.Url);
var request = new RestRequest("/account/Menu", Method.GET);
request.AddParameter("SSO_Token", token);
client.PreAuthenticate = false;
client.Authenticator = new RestSharp.Authenticators.NtlmAuthenticator(new NetworkCredential(username, password, domain));
// I also tried following codes with no luck:
// client.Authenticator = new RestSharp.Authenticators.NtlmAuthenticator();
// client.Authenticator = new RestSharp.Authenticators.NtlmAuthenticator(username, password);
var response = client.Execute(request);

现在的问题是我收到此错误:
HTTP Error 401.1 - Unauthorized
You do not have permission to view this directory or page using the credentials that you supplied.

我确定提供的凭据是正确的。

最佳答案

关于asp.net - 使用 RestSharp 请求带有 Windows 身份验证的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47534418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com