Angel Hernández

April 2009 - Posts

Invoking SharePoint WebServices when Forms Based Authentication is enabled / Invocando servicios Web de SharePoint cuando Autenticación Basada en Formas está habilitada

A couple of days ago I was writing a piece of code for a Sharepoint solution which has Forms based authentication enabled. I had to invoke some SharePoint WebServices but the only thing standing in the way... FBA (Forms Based Authentication) so after receiving a couple of 403 errors I realized that I had to change my approach. It's really easy and straightforward do this using SSPI (Windows Integrated Security, a.k.a. NTLM and Kerberos) because you just need to do something like this

 

but it's a different story when your authentication mechanism is not SSPI and for that purpose we have authentication.asmx located in the _vti_bin folder but before we proceed any further I'd like to add a comment in regards SharePoint's WebServices 

It's required to set the service's URL before calling it, for instance 
   
http://server/_vti_bin/authentication.asmx
however I want to authenticate or access a resource in a given site then I must specify this Url
   
http://server/MySite/_vti_bin/authentication.asmx 


The following code snippet illustrates how to do it  

Regards,

Angel


Hace un par de días estaba escribiendo un fragmento de código para una solución basada en SharePoint con autenticación basada en formas habilitada. Tenía que invocar unos servicios Web de SharePoint pero lo único que tenía en el camino... Autenticación basada en formas por lo que después de recibir un par de errores 403 me dí cuenta que tenía que cambiar el enfoque y manera de hacer las cosas. Es realmente fácil y sencillo hácerlo con  SSPI (Seguridad Integrada de Windows, conocido como NTLM y Kerberos) porque lo único que se necesita hacer es algo como esto   

 

Pero es una historia distinta cuando el mecanismo de autenticación no es SSPI y para esos casos tenemos  authentication.asmx que se encuentra en la carpeta _vti_bin folder sin embargo antes de proseguir me gustaría agregar un comentario en relación a los servicios Web de SharePoint  

Es requerido establecer el URL del servicio antes de realizar alguna llamada, por ejemplo 
   
http://server/_vti_bin/authentication.asmx
pero si quiero autenticarme o acceder un recurso en un sitio dado entonces debo especificar este Url
   
http://server/MySite/_vti_bin/authentication.asmx 


El siguiente fragmento de código ilustra como hácerlo  

Saludos,

Angel