In my Windows Store app (8.1), two consequent requests are sent to a server.
The first request is "https://a.b.com/ssologon", which gets a response from the server and an LtpaToken2
cookie is set to the app's cookies via the Set-Cookie header in the response.
This cookie looks like this
{LtpaToken2=base64StringReturnedFromServer;Path=/;Domain=a.b.com}
And before the 2nd request ("https://a.b.com/logon") is sent, I call the HttpCookieManager.SetCookie API to set the LtpaToken2
cookie again- which is already in the cookies, but this line throws an exception.
filter.CookieManager.SetCookie(new HttpCookie("LtpaToken2", "a.b.com", "/") {Value = base64StringReturnedFromServer});
The exception is generic and not quite informative:
An unhandled exception of type 'System.Exception' occurred in Windows.Web.winmd
Additional information: The operation identifier is not valid. (Exception from HRESULT: 0x800710DD)
More information on this exception:
It only happens to LtpaToken2
, in fact, there is another cookie, LtpaToken
, which can be freely set without throwing the exception.
It looks like it only happens if the domain I am trying to set is an exact match of the domain of the existing cookie. If I set it as .b.com, or s.a.b.com, it is OK.
What does the error message "The operation identifier is not valid." mean?
User contributions licensed under CC BY-SA 3.0