开发者

NTLM authentication with HttpWebRequest works in .net 4.0 but not 3.5

开发者 https://www.devze.com 2023-03-21 11:54 出处:网络
I have written some code to perform NTLM authentication using HttpWebRequest. If i set the target framework of winform app to 4.0 then it works.

I have written some code to perform NTLM authentication using HttpWebRequest. If i set the target framework of winform app to 4.0 then it works.

However, if I set it to 3.5 then it doesnt (it returns 401 u开发者_运维技巧nauthorized error). The first two connections are sent and received correctly, but on receiving the 2nd response. the client does not make the 3rd request and it simply says unauthorized.

My code is:

request = (HttpWebRequest)WebRequest.Create(authenticatedOpenAssetRssUrl);
            request.Credentials = new NetworkCredential(Environment.UserName, null);
            request.UserAgent = Constant.XML_FEED_USER_AGENT;
            request.UnsafeAuthenticatedConnectionSharing = true;

This is running on windows 7 x64 bit.


Check the security of Windows, the Network security: Minimum session security for NTLM SSP based (including secure RPC) clients. Uncheck Require 128-bit encryption and retest.


I to had the same issue. I was able to solve them by altering the highlighted local group policy all you need to do is right click on that policy and click properties and you need to uncheck the use 128 bit ssl Screenshot of the settings in local group policy

0

精彩评论

暂无评论...
验证码 换一张
取 消