我看如果你有把帐号名跟密码保存在Session state。你可以直接把帐号名跟密码输入ConnectionSetup。看看以下的代码。
SourceCode.Workflow.Client.Connection conn = null;
conn = new SourceCode.Workflow.Client.Connection();
SourceCode.Workflow.Client.ConnectionSetup connSetup = new SourceCode.Workflow.Client.ConnectionSetup();
connSetup.ConnectionString = string.Format("Integrated=False;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host={0};Port=5252;SecurityLabelName=K2SQL;UserID={1};Password={2};", serverName, txtUserID.Text, txtPassword.Text);
conn.Open(connSetup);