- Home /
How to use current user (Logged in user under Windows) credentials to connect web-server under IIS with Windows Authentication
Hello, I want to get data from a web-server (IIS) where Windows Authentication is enabled without additional prompt to the user to type its login and password.
I tried to set HttpWebRequest.UseDefaultCredentials = true
I tried to use WindowsIdentity (Impersonate, for example) to fill HttpWebRequest.UseDefaultCredentials = true and HttpWebRequest.Credentials = CredentialsCache.DefaultCredentials
I tried to use CredentialCache.DefaultCredentials
But all these methods do not work. Server returns the 401 Unauthorized.
I use Unity 2018.3.2 and tried varios combinations of the settings for the unity player like .Net 4.x, Mono/IL2CPP, .Net Standard 2.0/.Net 4.x
Hi Guys,
I wanted to implement the same for a Windows standalone build.
$$anonymous$$y requirement is to authenticate the current user, with his windows login.
Can i implement the code shared here or does it need any changes?
Answer by kyperevozchikov · Feb 01, 2019 at 09:54 AM
FYI, All listed methods above don't work because they all executed under Mono runtime. I just have implemented simple native (C++) dll which use WinHTTP library to get/post data with autologon to servers under Windows Authentications in our intranet (same domain) on Windows standalone Unity platform. That is all I was needed to.
If you are interested I publish project to github under open source license.
Very interesting! $$anonymous$$y C++ skill's are non-existent, so I would be very interested in testing your WinHTTP implementation. Hope you still publish to github! :)
It is already on github ;) Repo is "kyperevozchikov/WinHttpUnityPlugin"
Your answer
Follow this Question
Related Questions
Unity behind proxy + windows authentication 0 Answers
Speech to text 2 Answers
Mac OSX on windows and building out for iphone/ipad? 2 Answers
Change in functionality in windows build 0 Answers
How to get result message from System.Diagnostics.Process 0 Answers