I don't have a configuration that will allow me to test, but I believe this can be done by specifying a valid username and password during the TaskService instantiation.
TaskService ts = new TaskService("COMPUTERNAME", "remoteUserAcctName", "COMPUTERNAME", "remoteUserPassword");