I'm trying to login to a web service using Web Service
authentification. Everything works fine, but when I'm treating the case
where the user enters an invalid user name or password I get an
SoapHeaderException with the error message "The security token could
not be authenticated or authorized"
The problem is I end up with code like this when tryint to catch a bad
username or password:
catch (SoapHeaderException soapEx)
{
//A SoapHeaderException with this error message means that we have an
invalid login
if (soapEx.Message == "The security token could not be authenticated
or authorized")
throw new ArgumentException("Could not logon to the Server. The
UserName or Password is invalid");
else throw soapEx;
}
catch(Exception ex)
{
//Normal Logic
}
Is there a better way, i.e that doesn't compare the Message string from
the exception to know that the user name or password we passed along is
invalid?
Thanks
Pablo Cibraro [MVP] - 06 Dec 2006 15:56 GMT
Hi,
I work with WSE for a long time, and I think your approach is correct, there
aren't better ways to do the same.
Regards,
Pablo Cibraro
> I'm trying to login to a web service using Web Service
> authentification. Everything works fine, but when I'm treating the case
[quoted text clipped - 25 lines]
>
> Thanks