|
-
Dec 3rd, 2007, 03:04 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
I made a simple browser for my wifes class that can only go to one url but it seems to be remembering the last studient who logged on to the website.
i wanted to add something on close or load that would wipe out any cookies or cached sites.
I've been looking around but it looks like everything is geared to wiping out cache files for IE6 or other localy loaded browsers and not just this one instance.
-
Dec 11th, 2007, 11:42 AM
#2
Re: [2.0] How can I clear cookies and Cache the webbrowser?
I assume you used the web browser that 'comes with' Visual Studio, which is in fact a local instance of IE. You can then use Environment.GetFolderPath(Environment.SpecialFolder.Cookies), which you should then scan through for cookies whose names contain the top level domain name of your wife's website. Once you find those, delete it.
Do this in the application's close event.
Of course it'll be more useful if you could find some sort of a setting for that browser which cleared cookies upon unloading, but the method I've mentioned above should be good enough for you.
-
Apr 25th, 2009, 05:35 PM
#3
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
can anybody elaborate on this please?
How do I scan through the cookies? And then how do I delete them?
-
Apr 25th, 2009, 06:41 PM
#4
Not NoteMe
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
You would use the code mendhak provided to get the folder where the cookie files are stored. You'd then have to loop through each file in that folder, for each file (cookie) you'd do some check (such as seeing if it's for the relevent site in the above case), and delete it if appropriate.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 25th, 2009, 06:53 PM
#5
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
i'm getting an error, that I cant access the cookie folder.
-
Apr 26th, 2009, 04:43 AM
#6
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
Hey,
Can you post the code that you are using, so that we can verify that you are using it correctly?
Also, which OS are you using?
Gary
-
Apr 26th, 2009, 02:42 PM
#7
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
I was using mendhak's code.
I'm on vs2008express, windows 7
-
Apr 26th, 2009, 04:44 PM
#8
Not NoteMe
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
Does mendhak's code get the correct folder?
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 26th, 2009, 04:58 PM
#9
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
I'm using this now:
Code:
Function DeleteCookies(ByVal wb As WebBrowser)
wb.Document.Cookie.Remove(0, (wb.Document.Cookie.Count - 1))
Delay(1)
Return False
End Function
I think its working.
-
Apr 27th, 2009, 01:17 AM
#10
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
Hey,
Why are you using the Delay? I don't see why that would be needed in this case?
Gary
-
Apr 27th, 2009, 03:26 AM
#11
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
well idk, I dont want the code to proceed until the cookies are deleted, but maybe thats not the way you do it, just a try.
-
Apr 27th, 2009, 03:59 AM
#12
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
Hey,
Calling Remove is a simple synchronous method, so processing will not continue until that method completes executing, so in this case, the Delay is definitely not needed.
Gary
-
Apr 27th, 2009, 04:09 AM
#13
Lively Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
-
Jan 29th, 2010, 05:16 AM
#14
Junior Member
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
how would i do this in vb 6?
-
Jan 29th, 2010, 07:38 AM
#15
Re: [RESOLVED] [2.0] How can I clear cookies and Cache the webbrowser?
Hey,
If you have a VB6 question, you should post it in the VB 6 Forum.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|