Hi guys
We're having additional issues with our asynclogin handler.
We're calling the following:
var loginHandler = new Dynamicweb.Frontend.LoginHandler();
loginHandler.ExtranetLogOn(username, password, true);
But when doing so we get an System.InvalidOperationException: Collection was modified during the first login attempt. (it always work the 2nd attempt).
Stacktrace:
ved System.Collections.Specialized.NameObjectCollectionBase.NameObjectKeysEnumerator.MoveNext()
ved Dynamicweb.Environment.CookieManager.UpdateCookie(Cookie cookie)
ved Dynamicweb.Frontend.LoginHandler.SaveCookie()
ved Dynamicweb.Frontend.LoginHandler.ExtranetLogin(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserID, Boolean loginIfPwdEncrypted)
ved Dynamicweb.Frontend.LoginHandler.ExtranetLogOn(String username, String password, Boolean onlyActive)
The error seems to lie in Dynamicweb.Environment.CookieManager's UpdateCookie(Cookie cookie) method in the following foreach loop:
Cookie existingCookie = Context.Current.Response.Cookies[cookie.Name];
if ((existingCookie != null))
{
NameValueCollection cookieValueCollection = cookie.Values;
foreach (string key in cookieValueCollection.Keys)
{
existingCookie[key] = cookieValueCollection[key];
}