locked
Sharepoint Web Service - Authentication RRS feed

  • Question

  • Hi,

    I tried to use the builtin web service http://<server>/_vti_bin/Authentication.asmx with this code...


    Authentication authSvc = new Authentication();
    
    authSvc.CookieContainer = new System.Net.CookieContainer();
    authSvc.AllowAutoRedirect = true;
    LoginResult result =  authSvc.Login(username, password);
    
    
    if (result.ErrorCode == LoginErrorCode.NoError)
    {
           //My code here...      
    }
    
             
    But I always had, for LoginResult.ErrorCode the value "LoginErrorCode.NotInFormsAuthenticationMode ".

    I know that the username/password that I use have the correct credentials.

    Anybody have an idea?

    Thanks
    Thursday, February 25, 2010 8:59 PM

Answers

  • The error message suggested that your site is not configured as Form Based Authentication.

    The prerequisite for using Authentication Web Service is that it should be hosted in a FBA site, as described in MSDN
    Authentication:    Specifies a client proxy that provides user authentication for SharePoint sites that use forms-based authentication .

    Therefore, you cannot use this web service in authentication mode that is not FBA.

    Cogito, ergo sum.
    Monday, March 1, 2010 2:03 AM

All replies

  • Thursday, February 25, 2010 9:49 PM
  • Hello

    Check this http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/79e30836-2150-4fce-8498-a0aa7ffbdf82

    This might help you

    Ashish Kanoongo, MCP, MCSD, MCTS

    The thread you suggest to me talk about a unresolved url.... but in my case I'm able to browse my
    "http://<server>/_vti_bin/Authentication.asmx "

    The problem is when I tried to called it within my windows application, I receveid the 401 unauthorized error, with the "LoginErrorCode.NotInFormsAuthenticationMode "
    Thursday, February 25, 2010 10:00 PM
  • Try this

    Authentication authSvc = new Authentication();
     authSvc.Url = @"http://<server>/_vti_bin/Authentication.asmx";
    authSvc.Credentials = CredentialCache.DefaultCredentials;

    authSvc.CookieContainer = new CookieContainer()
    authSvc.AllowAutoRedirect = true;
    LoginResult result =  authSvc.Login(strDomain + @"\" +username, password);


    Ashish Kanoongo, MCP, MCSD, MCTS
    Thursday, February 25, 2010 10:14 PM
  • Try this

    Authentication authSvc = new Authentication();
     authSvc.Url = @"http://<server>/_vti_bin/Authentication.asmx";
    authSvc.Credentials = CredentialCache.DefaultCredentials;

    authSvc.CookieContainer = new CookieContainer()
    authSvc.AllowAutoRedirect = true;
    LoginResult result =  authSvc.Login(strDomain + @"\" +username, password);


    Ashish Kanoongo, MCP, MCSD, MCTS

    That's exactly what I'm doing and that's not working...
    Thursday, February 25, 2010 10:44 PM
  • So...

    No one else faced this problem ?
    Friday, February 26, 2010 2:29 PM
  • Can u post your code here
    Ashish Kanoongo, MCP, MCSD, MCTS
    Friday, February 26, 2010 4:29 PM
  • Can u post your code here
    Ashish Kanoongo, MCP, MCSD, MCTS

    Authentication authService = new Authentication(); authService.CookieContainer = new System.Net.CookieContainer(); authService.Credentials = System.Net.CredentialCache.DefaultCredentials; authService.AllowAutoRedirect = true; LoginResult result = authService.Login(domain + @"\" + user, pwd); if (result.ErrorCode == LoginErrorCode.NoError) { //Code never step into here.... //ErrorCode always equal to NotInFormsAuthenticationMode }
    Ashish...

    There's my exact code.

    Thanks,
    Friday, February 26, 2010 7:29 PM
  • It seems you are using Form Base Authentication ? In that case you should see

    http://msdn.microsoft.com/en-us/library/authentication.aspx
    http://www.codeproject.com/KB/sharepoint/SharePointWSAccess.aspx







    Ashish Kanoongo, MCP, MCSD, MCTS
    Sunday, February 28, 2010 5:27 AM
  • The error message suggested that your site is not configured as Form Based Authentication.

    The prerequisite for using Authentication Web Service is that it should be hosted in a FBA site, as described in MSDN
    Authentication:    Specifies a client proxy that provides user authentication for SharePoint sites that use forms-based authentication .

    Therefore, you cannot use this web service in authentication mode that is not FBA.

    Cogito, ergo sum.
    Monday, March 1, 2010 2:03 AM