NTLM Authentication

2,000 views
Skip to first unread message

bro...@cox.net

unread,
Dec 21, 2012, 2:55:27 PM12/21/12
to rest...@googlegroups.com
HI. I am trying to post a reqt request but need to authenticate using NTLM. I am using silverlight 5 with .net 4. When viewing the request in Fiddler I do not see an authorization header and I am getting a 401 error. Is there something specific I need to do to pass the authentication with the request? Any help is greatly appreciated.

John Sheehan

unread,
Jan 10, 2013, 5:12:41 PM1/10/13
to rest...@googlegroups.com
post your code

Michael DeMond

unread,
Jan 14, 2013, 4:05:17 PM1/14/13
to rest...@googlegroups.com
I am getting the same issue.  I think there's a bug in RestSharp for Windows Authentication scenarios.  The WebRequest requires PreAuthenticate = True in order to authenticate with a Windows Authenticated application/server.  Currently it appears that this property is not being set, nor can it be.  Is this a legitimate bug and/or is there a work around.

Michael DeMond

unread,
Jan 14, 2013, 4:53:27 PM1/14/13
to rest...@googlegroups.com
OK I figured it out.  Well, my problem at least.  In your Authentication section in IIS, select Windows Authentication and click "Providers..." under Actions on the right.  Make sure NTLM is at the top.

guil...@augview.net

unread,
Jan 27, 2015, 9:39:28 PM1/27/15
to rest...@googlegroups.com
Hi,

I am using RestSharp for unity3d branch.
I can't manage to authenticate with a server asking NTLM.

Here is my code:

RestClient rc = new RestClient("myurl");
rc
.Authenticator = new RestSharp.NtlmAuthenticator(credentials);
RestRequest rr = new RestRequest("myurl",Method.GET);
rr.Credentials = credentials;
rc
.Execute(rr);

The server always sends me back 401 unauthorized.
Is NTLM authentication actually working?

thanks

Guillaume

sachin mhalungekar

unread,
Dec 6, 2017, 9:50:48 AM12/6/17
to RestSharp
If you are trying to access service which is hosted on windows authentication then do following,


var request = new RestRequest(Method.POST);

if you want to use applications default credentials which must have access on hosted service server

request.UseDefaultCredentials = true;

OR user below to pass the credentials manually

 request.Credentials = new NetworkCredential("Username", "Password", "Domain");

Scott Drummond

unread,
Jul 24, 2018, 9:58:50 AM7/24/18
to RestSharp
old post but when I make the first request to authenticate this way should I post to the Application or the ID Provider? 
Reply all
Reply to author
Forward
0 new messages