Access Denied using Windows Authentication. WSE 2.0

C

Chey Zaga

When using custom authentication (using the UsernameTokenManager interface.)
I am able to log in, but can't authenticate using windows authentication.

System:
XP pro work station.
My domain login had administrative privileges on my machine.
WSE 2.0
IIS: I checked off the anonymous access on the web service virtual
directory.
I have both the client and the web service on my local machine.

Error Message:
System.Net.WebException: The request failed with HTTP status 401: Access
Denied. at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
WebService1Client.WeblogProxy2.Service1Wse.Test() in
c:\inetpub\wwwroot\webservice1client\web
references\weblogproxy2\reference.cs:line 37 at
WebService1Client.ClientCredentialsProxy.Page_Load(Object sender, EventArgs
e) in
c:\inetpub\wwwroot\webservice1client\clientcredentialsproxy.aspx.cs:line 52

Client Code:
// Create a UsernameToken
UsernameToken token = new UsernameToken( Username, Password,,
PasswordOption.SendPlainText);
// Create an instance of the proxy
WeblogProxy2.Service1Wse proxy = new WeblogProxy2.Service1Wse();
// Add the SecurityToken to the Request
Contextproxy.RequestSoapContext.Security.Tokens.Add( token );
try
{
string xx = proxy.Test();
}
catch( Exception ex )
{
Response.Write( ex.ToString() );
}


Any help will be appreciated.
Thanks.
 
A

Arthur Nesterovsky

Hi,
Client Code:
// Create a UsernameToken
UsernameToken token = new UsernameToken( Username, Password,,
PasswordOption.SendPlainText);
// Create an instance of the proxy
WeblogProxy2.Service1Wse proxy = new WeblogProxy2.Service1Wse();
// Add the SecurityToken to the Request
Contextproxy.RequestSoapContext.Security.Tokens.Add( token );
try
{
string xx = proxy.Test();
}
catch( Exception ex )
{
Response.Write( ex.ToString() );
}

Try the following:

// use the current logged in user's credentials
proxy.Credentials = CredentialCache.DefaultCredentials;

or

// use the specified user's credentials
proxy.Credentials = new NetworktCredentials(Username, Password, Domain);
 
C

Chey Zaga

Thank you Arthur, that solved the issue.

Arthur Nesterovsky said:
Hi,


Try the following:

// use the current logged in user's credentials
proxy.Credentials = CredentialCache.DefaultCredentials;

or

// use the specified user's credentials
proxy.Credentials = new NetworktCredentials(Username, Password, Domain);

--
______________________________
With best wishes, Arthur Nesterovsky
Please visit my home page:
http://www.nesterovsky-bros.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top