x
Main Site login Signup

SetCookie sometimes does not set cookie

Hi,

I have a problem with SetCookie that happens randomly, I am creating a new WebControl when my view (I am using MVVM) is loaded (code below)

 this._webControl = new WebControl
     {
     Source = "about:blank".ToUri(), 
     WebSession = WebCore.CreateWebSession(
         new WebPreferences
             {
             WebSecurity = false, 
             AllowInsecureContent = true, 
             Plugins = true, 
             SmoothScrolling = true, 
             EnableGPUAcceleration = true, 
             WebGL = true
             })
     };
 this._webControl.ViewType = WebViewType.Offscreen;
 var parentView = this._webControl.ParentView;
 this._webControl.WebSession.ClearCache();
 this._webControl.WebSession.ClearCookies();
 
 ...
 
 this._webControl.WebSession.SetCookie(
     domain.ToUri(), 
     "CookieName=" + this.Context.Identity.Token, 
     false, 
     true);

 this._webControl.Source = source.ToUri();
   

Now this works for the most part, but periodically when I run this code the cookie does not get set and the page loaded by the application fails to load as a result. The application is a WPF application that handles user login and hands off the security token to the browser control in a cookie.

This issue is puzzling me and I am curious if anyone else has ever encountered this? Also I would like to know if there is a way to guarantee that a cookie has been set, or a way to read the cookies after setting them so I could ensure the cookie is there?

asked Jun 09, 2016 at 06:33 AM avatar image stevensn99 0
more ▼
(comments are locked)
10|1100 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.