如何使用Angular HTTP Post Call通过NTLM凭据?
我正在Localhost工作,那里使用2个不同端口的Angular和Web API现在引起了问题。
我试图从Angular上调用Web api c#
this.http.post< accessToken>(`$ {$ {this.url}/api/home/home/eid/?code = 12345sfffs`,{headers:this.htttpheaders}) 。 console.log(“ hi”); console.log(响应); 返回响应; }); ````````
但是我要低于错误,
无法加载资源:
当我尝试在Postman中尝试时,该服务器以401的状态(未经授权)响应,我也遇到了相同的401错误,后来我通过在Postman中添加NTLM凭据来修复以获取200响应。
但是如何通过Angular Post Call传递NTLM凭据? 为什么Web API期望NTLM凭据?
提前致谢!
I am working on localhost where angular and web api using 2 different ports that's causing issue now.
I am trying to call web api c# from angular like this
this.http.post<AccessToken>(`${this.url}/api/Home/Eid/?code=12345sfffs`,{headers:this.httpHeaders}) .pipe(Response => { console.log("hi"); console.log(Response); return Response; }); ```
But I am getting below error
Failed to load resource: the server responded with a status of 401 (Unauthorized)
When I tried in postman also I got same 401 error and later I fixed by adding NTLM credentials in postman to get 200 response.
But how to pass NTLM credentials from angular post call?
And why web api expecting for NTLM credentials?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经在Web API中修改了我的Angular帖子呼叫
,我对此进行了修改。
I have modified my angular post call to this
In Web API, I have modified web.config to this