Results 1 to 8 of 8

Thread: Cookie Deleter : Runtime Error 70 : Permission Denied

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119

    Resolved Cookie Deleter : Runtime Error 70 : Permission Denied

    hello, I'm having a frustrating problem. I'm fairly new to VB...

    Info >> Cookie Deleter
    Runtime Error >> 70
    Comment >> Permission Denied

    I'm attempting to write a program that deletes all cookies from my hard drive, yesterday it was working however when I compiled it, it isnt, now im back at the code and it aint working anymore so I really need help cause I dunno any other methods or I'm maybe missing something.

    Code:
       'On Error Resume Next
    
       Dim LOGONNAME As String
       LOGONNAME = Text2.Text
       
       If Text2.Text = "Your Windows Log On Name" Then
           MsgBox "You Need To Specify An Windows Logon Name", vbExclamation, "Error"
       Else
           Kill ("C:\Documents and Settings\" & LOGONNAME & "\Cookies\*.*") 'delete all cookies with wildcard
           MsgBox "All Cookies Were Successfully Deleted!", vbInformation, "Successful Deletion"
       End If
    note: I commented out on error resume next to correct this problem, usually I would have this in to stop it closing upon error however I having trouble fixing this problem, please help, any input welcome, ty
    Last edited by Shadows; Oct 26th, 2004 at 07:41 AM.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    I think you're trying to delete the cookies from a users folder, that isn't logged in. Either that or, Kill isn't letting you delete files from a Read-Only folder (the cookies folder).

    Are you logged on as a user and trying to remove the Administrators cookies?

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    don't have IE open at the time.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119
    ty for the reply

    I am the administrator and only this account exists on my computer, when I installed windows I only made one user(myself) so I know the logged on name is correct

    also I forgot to explain, I have this in my form's code

    VB Code:
    1. Private Declare Function GetUserName& Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long)
    2.  
    3. Public Function GetCurrentUser() As String
    4. Dim strUsername As String
    5.    
    6. strUsername$ = String(200, " ")
    7. GetUserName strUsername, 200
    8. strUsername$ = Trim(strUsername$)
    9.  
    10. GetCurrentUser = Left(strUsername$, Len(strUsername$) - 1)
    11. End Function
    12.  
    13. Private Sub Form_Load()
    14.  
    15. Text2.Text = GetCurrentUser
    16. Text2.Enabled = False
    17.  
    18. End Sub
    19.  
    20. Private Sub Label5_Click()
    21.    
    22.     'On Error Resume Next
    23.     Dim LOGONNAME As String
    24.     LOGONNAME = Text2.Text
    25.    
    26.     If Text2.Text = "Your Windows Log On Name" Then
    27.         MsgBox "You Need To Specify An Windows Logon Domain", vbExclamation, "Error"
    28.     Else
    29.         Kill ("C:\Documents and Settings\" & LOGONNAME & "\Cookies\*.*") 'delete all cookies with wildcard
    30.         MsgBox "All Cookies Were Successfully Deleted!", vbInformation, "Successful Deletion"
    31.     End If
    32.        
    33. End Sub

    I hope that makes its more clear, btw, thanks for the reply
    Last edited by Shadows; Oct 26th, 2004 at 03:24 AM.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119
    Originally posted by dglienna
    don't have IE open at the time.
    jst tryed it, it doesnt make any difference
    Last edited by Shadows; Oct 26th, 2004 at 04:39 AM.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119
    weird, if I change this line

    VB Code:
    1. Kill ("C:\Documents and Settings\" & LOGONNAME & "\Cookies\*.*") 'delete all cookies with wildcard

    to this

    VB Code:
    1. Kill ("C:\Documents and Settings\" & LOGONNAME & "\Cookies\*.txt") 'delete all cookies with wildcard

    it works

    but I dont understand why that works and the full wildcard doesnt > *.*

    when I change it to *.txt

    it deletes them fine, anyway, solved

  7. #7
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148
    You probably cannot delete the index file (index.dat)

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119
    ah yes, that would seen correct as I noticed all cookies are gone and index.dat remains, well spotted:d

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width