Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Credentials getting passed in 4.7.1, but not Core 2.0?

$
0
0

The following code in a webapi application targetting netcoreapp2.0 results in "One or more errors occurred. (The remote server returned an error: (401) Unauthorized.)'": 

var url = "...";
var webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.UseDefaultCredentials = true;
webRequest.CookieContainer = new CookieContainer();
webRequest.Method = "GET";
using (var response = webRequest.GetResponseAsync().Result)
{
......

I also get a 401 with WebClient.  However, I don't run into an authentication problem when the app is targetting net471.

I'm trying to pass along Windows credentials along in this request.  Why does this work only if I target vanilla .NET?  Is there a workaround?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>