Search This Blog

Monday, January 23, 2012

Microsoft.Web.Services2 401 Unauthorized

If you encountered this error using Web.Services2 from Microsoft just try:

var service = new JasperService("http://localhost:8088/jasperserver/services/repository");
var cred = new NetworkCredential("someUser", "somePass");
service.Credentials = cred;

If this does not work for you try:

SoapContext requestContext = service.RequestSoapContext;
UsernameToken userToken =
    new UsernameToken("someUser", "somePass",
                      PasswordOption.SendPlainText);
requestContext.Security.Tokens.Add(userToken);
requestContext.Security.Timestamp.TtlInSeconds = 86400;

1 comment:

  1. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    ReplyDelete

If you like this post, please leave a comment :)