clobba / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
GNU Lesser General Public License v3.0
0 stars 0 forks source link

private browsing doesnot allow to store any cookies #90

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In private browsing ows(r105) does not allow to store cookies. I cant login to 
any website.
What I need is that in private browsing, user logs in to whichever website he 
wishes, but after he switch private browsing off, all those cookies are deleted.

for this I thought to change the cookie storage path temporarily and used 
following class
WebKit.Interop.WebCookieManagerClass xy = new 
WebKit.Interop.WebCookieManagerClass();

But this throws COMException
Any way to achieve this???

What version of the product are you using? On what operating system?
openwebkitsharpr105 windows 7(32bit)

Original issue reported on code.google.com by mamtagan...@gmail.com on 23 Mar 2012 at 6:47

GoogleCodeExporter commented 8 years ago
In order to use WebCookieManagerClass you must firstly Activate the 
ActivationContext. This can be done in the latest version via 
WebKitBrowser.ActivateContext(); but is not available in r105. You can add this 
code manually:

        public static void ActivateContext()
        {
            activationContext.Activate();
        }
        public static void DeactivateContext()
        {
            activationContext.Deactivate();
        }

Original comment by tsumalis96@gmail.com on 23 Mar 2012 at 12:30

GoogleCodeExporter commented 8 years ago
I switched to latest version n used the same.

However, using the following code

WebKit.WebKitBrowser.ActivateContext();
                WebKit.Interop.WebCookieManagerClass xy = new WebKit.Interop.WebCookieManagerClass();
                IntPtr p = xy.cookieStorage();
                MessageBox.Show(p.ToString());
                WebKit.WebKitBrowser.DeactivateContext();

gives some random number. Any every time I restart the project, number is 
different.

I guess i am moving to some other direction.

I basically want to allow user to login even in private browsing mode.
Is it possible??

Thanks.

Original comment by mamtagan...@gmail.com on 23 Mar 2012 at 3:11

GoogleCodeExporter commented 8 years ago
Try using <webkitbrowser>.WebView.preferences().setPrivateBrowsingEnabled(1); 
(or sth like this) instead of Browser.Preferences.PrivateBrowsing.

Original comment by tsumalis96@gmail.com on 27 Mar 2012 at 7:56

GoogleCodeExporter commented 8 years ago
yeah now its working fine.. 

I have one more question related to cookies...
Can we have more than one cookie file on a system??If yes, how???

Actually, i need it for one feature of my browser..

Any help would be appreciated.. :) Thanx..

Original comment by mamtagan...@gmail.com on 29 Mar 2012 at 5:55

GoogleCodeExporter commented 8 years ago
I don't know... WebCookieManager only allows IntPtr storages, which I don't 
know if and how represent a cookie file.

Original comment by tsumalis96@gmail.com on 1 Apr 2012 at 10:29

GoogleCodeExporter commented 8 years ago
Is it possible to retrieve the entries of my cookies? ex. userid, etc...how?

Original comment by hyec...@gmail.com on 27 Apr 2012 at 2:30

GoogleCodeExporter commented 8 years ago
Take a look at here: 
http://gt-web-software.webs.com/apps/forums/topics/show/7643709-retrieving-cooki
es-in-csharp?page=last

Original comment by tsumalis96@gmail.com on 4 May 2012 at 9:10

GoogleCodeExporter commented 8 years ago
ok, thanks

Original comment by hyec...@gmail.com on 5 May 2012 at 1:53