Share via


Terminating a Session

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

A client can terminate a session by sending the server a terminateSession request. A client should do so before the application is closed. After the request is made, the client should also clean up other resources used in the closed session. Such resources include the asynchronous event polling thread.

After a session is terminated, a client can ask the server to open another session with the previously cached authentication ticket.

C# code example for terminating a session

public void TerminateSession()
{
  string strRequest="<cwaRequests xmlns=\"http://schemas.microsoft.com/2006/09/rtc/cwa\">" +
                   + "   <terminateSession rid="9"/>"
                   + "</cwaRequests>";
  XmlDocument xmlRequest = new XmlDocument();
  xmlRequest.LoadXml(strRequest);
  string url = this.serverUrl + "/cwa/MainCommandHandler.ashx";
  SendRequest(url, xmlRequest);
  connected = false;
  sessionId = 0;

  dataChannel.CancelAsync();
  this.dataChannelCancelled = true;
}

See Also

Concepts

Using Unified Communications AJAX API

Unified Communications AJAX API Reference