Developer

Windows Applications Fail to Communicate with Siteminder

Windows applications are unable to retrieve data after the application restarts when communicating with Siteminder, because cookies are not persisted.

Problem

When communicating with Siteminder server and creating OData requests, after registration the SMSESSION cookie is created and the application sucessfully sends requests. After restarting the application the SMSESSION is required again. By default the Siteminder server sends the cookie request which needs to be sent by the client. In some cases the request is not sent and the SMSESSION cookie is not created by the server so the client cannot communicate with the server.

Fix

Insert the following lines of code before the first OData request, which requests the SMSESSION cookie from the Siteminder server to enable communications with the Siteminder Server:
var baseUri = new Windows.Foundation.Uri(sURL);
var filter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
var cookie = new Windows.Web.Http.HttpCookie("SMCHALLENGE", baseUri.host, "/");
cookie.value = "YES";
filter.cookieManager.setCookie(cookie, false);