I have SharePoint Server 2010 with windows authentication(ntlm).

We are working in java and want to authenticate a user, which is in active directory.

We tried using authentication.asmx but it returned "NotInFormsAuthenticationMode".

I read on the internet that I need to enable forms authentication on my website.

But I don't want to enable forms authentication, so I just want to know is there any way that I can authenticate users without enabling form authentication?

One more question, if I enable forms authentication, will the authentication.asmx authenticate users in active directory?

  • What are you trying to achieve ? Are you trying to enable single sign on for the java and sharepoint . Or you want to enable AD authentication in Java?
    – Thomson
    Dec 8, 2011 at 11:29

2 Answers 2


Authentication.asmx provides user authentication only for SharePoint sites that use forms-based authentication.

If you want to use SharePoint web services you can pass windows credentials as below :

serviceProxy.Credentials = new NetworkCredential("UserName", "Password", "domain");


serviceProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

Authentication.asmx doesn't need to be used. You should be able to pass the authentication details directly as part of the HTTP request object for the web service that you want to use.

I am no expert on implementing Java-based HTTP requests, but it looks like this link should give you some idea on how your request needs to be structured: http://blog.whitehorses.nl/2011/01/23/using-a-servlet-to-connect-to-ntlm-web-service/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.