Groups | Blog | Home
all groups > dotnet web services > november 2006 >

dotnet web services : Access denied


Brian Roisentul
11/6/2006 5:29:33 AM
Hello,

I'm developing a windows application using a web service from
Sharepoint(please let me know if I'm posting in the right group).

The problem is that when I try to use any Sharepoint Portal object's
method, I get the following exception:

"System.Web.Services.Protocols.SoapException:
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.UnauthorizedAccessException: Access is
denied"

If I access to a "Hello World" method it works.

Any ideas?

Thanks,

Brian
Claus Konrad [MCSD]
11/6/2006 9:27:02 AM
It is my impression (i.e. as far as I remember!), that the WS exposed by WSS
are requiring you to sign the request using your Windows Credentials to be
allowed access.

Set the proxy.Credentials = CredentialCache.UseDefault;

That will associate your client's credentials (your app) to the httprequest
behind the asmx webservices exposed by WSS.
--
rgds.
/Claus Konrad
MCSD.NET (C#)


[quoted text, click to view]
Brian Roisentul
11/7/2006 7:01:15 AM

Hello Claus,

Thanks for your quick response.

I've already signed the Windows Credentials but nothing happens.

In this application I'm working with a lot of web service that use
Sharepoint and all work fine.

I wanted to know what do I have to set in my web service's Web Site:

* Do I have to use the DefaultAppPool, or Sharepoint's instead?

* About the Directory Security tab info:

. Do I have to check the "Basic Authentication" option?
. Do I need to enable the anonymous access option?



The following code is an simple example I wrote to see if it worked,
but It throws me the exception I posted before.

------------------------------------------------------------------

string Url="http://localhost:120/sites/mySite/default.aspx";

SPWeb site = new SPSite(Url).OpenWeb();

return site.CurrentUser.LoginName;

------------------------------------------------------------------

If I build a windows application and run this code, it works fine. But
if I expose it as a web service from another computer, even though I
use Network Credentials to authenticate(It works fine for the other web
services), it doesn't work either.

If you have any ideas or questions, just let me know please.

Thanks,

Brian
AddThis Social Bookmark Button