Logging In


In order to log in to your account, you need to provide your account name, user name and password.
Below are examples that send this information using security tokens of Web Service Enhancements.

Example in Visual Basic .Net

Try
        'create an instance of the proxy class
        Dim BTService As New Elementool.BugTrackingWse
        '(user name = "account\username")
        Dim token As New UsernameToken(MyAccountName & "\" & MyUserName, MyPassword, _
                                                                PasswordOption.SendHashed)
        BTService.RequestSoapContext.Security.Tokens.Add(token)
        BTService.RequestSoapContext.Security.Elements.Add(New MessageSignature(token))
        'this method does nothing but throws an exception if login info is incorrect
        BTService.LoginCheck()
Catch ex As Exception
        MsgBox("Login Failed!")
End Try

Example in C#

try
{
    //create an instance of the proxy class
    Elementool.BugTrackingWse BTService = new Elementool.BugTrackingWse();
    //(user name = "account\username")
    UsernameToken token = new UsernameToken(MyAccountName + "\\" + MyUserName, MyPassword, PasswordOption.SendHashed);
    BTService.RequestSoapContext.Security.Tokens.Add(token);
    BTService.RequestSoapContext.Security.Elements.Add(new MessageSignature(token));
    //this method does nothing but throws an exception if login info is incorrect
    BTService.LoginCheck();
}
catch (Exception ex)
{
    MessageBox.Show("Login Failed!");
}