When I tried to access it using Client Object Model with my NTLM credentials I got 401 (Unauthorized) exception. I googled and found this solution
...
clientContext.ExecutingWebRequest += new EventHandler(clientContext_ExecutingWebRequest);
...
}
static void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e)
{
e.WebRequestExecutor.WebRequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
}
This works well for me.
Then when I tried to access same site using Lists.asmx web service with same NTLM credentials I got exactly same exception.
I added this method to the Web Service wrapper class (it's in Web References > ListWebService > Reference.map > Reference.cs in my case)
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.WebRequest wr = base.GetWebRequest(uri);
wr.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
return wr;
}
That solved the issue as well.
Thanks for posting! This just solved my problem that I had. See http://sharepoint.stackexchange.com/questions/14130/how-do-i-avoid-redirection-for-web-service-authentication-in-sharepoint-2010-when/14132#14132 for details.
ReplyDeleteHello, great post and it solves my problem partially.
ReplyDeleteI still get the same error when I try to connect from within a SharePoint Custom web service to another SharePoint Custom web service.
The first web service is called from a Windows Service or from a Windows application. Within the first web service the authentication is working fine and I can get the SPContext.Current.Web.CurrentUser property correctly.
When I try to access another custom made SharePoint webservice within the ISAPI folder I can not get the SPContext.Current.Web.CurrentUser property while it is NULL.
Both web services are extended with the GetWebRequest override.
Do you know what I am missing?
Thanks in advance!
Problem solved by adding the following piece of code to the initialization of the web service:
ReplyDelete//Check if a HttpContext exists. When calling this from a console app this will be null and settings cookie is not neccessary.
HttpContext CurrentContext = HttpContext.Current;
if (CurrentContext != null)
{
myPermissionService.CookieContainer = new System.Net.CookieContainer();
HttpCookie authCookie = CurrentContext.Request.Cookies["FedAuth"];
if (authCookie != null)
{
//when the service is requested anonymously, for example to recover a password, the forms auth cookie will not exist
myPermissionService.CookieContainer.Add(new Cookie("FedAuth", authCookie.Value, authCookie.Path, CurrentContext.Request.Url.Host));
}
}
coin haber - koin haber - kripto para haberleri - coin haber - instagram video indir - instagram takipçi satın al - instagram takipçi satın al - tiktok takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - instagram takipçi satın al - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - binance güvenilir mi - instagram beğeni satın al - instagram beğeni satın al - google haritalara yer ekleme - btcturk güvenilir mi - binance hesap açma - kuşadası kiralık villa - tiktok izlenme satın al - instagram takipçi satın al - sms onay - paribu sahibi - binance sahibi - btcturk sahibi - paribu ne zaman kuruldu - binance ne zaman kuruldu - btcturk ne zaman kuruldu - youtube izlenme satın al - torrent oyun - google haritalara yer ekleme - altyapısız internet - bedava internet - no deposit bonus forex - erkek spor ayakkabı - tiktok jeton hilesi - tiktok beğeni satın al - microsoft word indir - misli indir - instagram takipçi satın al
ReplyDeletemarsbahis
ReplyDeletetrendbet
galabet thanks yees
Fon perde modelleri
ReplyDeletemobil onay
TÜRK TELEKOM MOBİL ÖDEME BOZDURMA
nft nasil alinir
ANKARA EVDEN EVE NAKLİYAT
TRAFİK SİGORTASİ
dedektör
web sitesi kurma
aşk kitapları
smm panel
ReplyDeletesmm panel
İs ilanlari
İnstagram Takipçi Satın Al
https://www.hirdavatciburada.com
HTTPS://WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR
Servis
Jeton Hilesi İndir