We have the following code
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace Console99
{
internal class Program
{
public Program()
{
}
private static void Main(string[] args)
{
try
{
using (HttpClient client = new HttpClient(new HttpClientHandler()
{
UseDefaultCredentials = true
}))
{
var result = client.GetAsync("https://server/WS/api/UsersApi?id=012314");
var a = result.Result.StatusCode;
Console.Write("hello: " + a);
}
}
catch (Exception exception)
{
Console.Write(exception.StackTrace);
}
Console.ReadKey();
}
}
When the code runs from a user with Local Admin permissions, it works OK. When a 'limited' user runs the code, it fails. What is strange though is after a local admin has ran the code, the regular user now may run the code. It seems like this first admin-run does something to allow the following users to run it.
Any idea what this could be?
I should note, this happens when we run an app from a network share. when the same user runs the same code from his local PC it works fine.