3

I have a SharePoint 2013 web application configured for both Windows Authentication and FBA (which is working fine).

I also have some code which executes a CSOM request using windows credentials, this is also working fine.

The problem is when I introduce a custom sign-in page. When I do this the form works fine (allows FBA users to login to SharePoint) but all of my CSOM API calls fail with:

"Cannot contact site at the specified URL"

If I look in Fiddler when my CSOM request is executed I can see that the calls are:

Default Sign In Page

  • 401 /_vti_bin/sites.asmx
  • 200 /_vti_bin/sites.asmx
  • 200 /_vti_bin/client.svc/ProcessQuery (contains correct JSON response)

Custom Sign In Page

  • 302 /_vti_bin/sites.asmx
  • 401 /_layouts/15/TestLogin/Login.aspx (my custom login form)
  • 302 /_layouts/15/TestLogin/Login.aspx (redirect them to the Win Auth login)
  • 302 /_windows/default.aspx (the OOB "windows login" form)
  • 200 /_vti_bin/sites.asmx
  • "ProcessQuery" is never hit

Note - for clarity this is not using Apps. This is a CSOM call from a Console Application!

  • I expect you are not using a token (S2S or OAuth) instead relying on the default Bearer token header. Given that, what you are seeing is not a surprise -- it is likely not a common scenario. Have you tried using Token Helper? – Paul Schaeflein Feb 21 '14 at 17:26
  • Sorry .. should've been more specific, these are not app calls. Just standard CSOM from a Console App – Martin Hatch Feb 21 '14 at 17:35
  • If you can't get an AAM setup that has NTLM only, them I'm afraid you may need to do the whole SAML Active Login process. That means your code needs to hit the token issuer and get the Auth token needed by SharePoint. – Paul Schaeflein Feb 21 '14 at 18:49
  • 1
    The solution was using the out of the box "Sign-In" form and using an HttpModule to redirect URLs from _login/default.aspx to my custom form ... not brilliant but it allowed the API calls to go through – Martin Hatch Mar 11 '14 at 16:43
1

We ran into the same behaviour on one of our customers systems. There are multiple web applications with forms authentication and custom login pages. In one of the web apps CSOM calls worked and in another one they did not. After verifying your solution I found some other:

It turned out, that the location of the login page was the essential point! The web application that used a login page from ~/_login/-folder (/identitymodel/login in 15-hive) worked and the one with a login page inside the _layouts folder does not.

Simply moving the login page to ~/_login/ and correcting style links, et cetera, made CSOM calls work here, too.

  • Of course!!! gold star to that man! – Martin Hatch Aug 31 '16 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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