Results 1 to 15 of 15

Thread: [RESOLVED] [2005] deleting

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Resolved [RESOLVED] [2005] deleting

    right now, im using Windows Vista..

    in Windows XP, deleting a file is working with this code

    Code:
    System.IO.File.Delete("C:\testdelete.jpg")
    But in Windows Vista, i encounter this message: Access to the path 'C:\testdelete.jpg' is denied.

    why its happening? what is the solution for this?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] deleting

    Is UAC enabled? If so, you need elevated privlidges to delete files from many folders.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] deleting

    how would i know if UAC is enabled?

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] deleting

    UAC are those prompts that ask for your permission to continue operations.

  5. #5
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] deleting

    The C:\ root drive is restricted in Vista, you'll have to put your files elsewhere
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] deleting

    oh in vista? it does not prompt in Vista when im using vb.net?

    pls instruct me what to do enable it pls?

  7. #7
    Addicted Member
    Join Date
    Oct 2008
    Posts
    202

    Re: [2005] deleting

    My Project > Application > View UAC Settings

    Change:

    uiAccess="false"
    to
    uiAccess="true"

    Then you always run your Software as Administrator

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [2005] deleting

    Is the application for your exclusive use, or do you intend others to use it?

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] deleting

    for my personal but, it will be for future use of others too..

  10. #10
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [2005] deleting

    Quote Originally Posted by arshesander
    ..... it will be for future use of others too..
    In that case, it is possible that the users may have Vista, therefore you need to take that into account. As mentioned on Vista OS's you should stear clear of the HDD root ('C:') for installs. There are a few posts on this forum relating to Vista install options.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] deleting

    I go to

    My Project > Application >

    but no View UAC Settings is vs.net 2005?

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: [2005] deleting

    OH i see.. thanks guys..

  13. #13
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [RESOLVED] [2005] deleting

    Not sure about VB.2005, however in 2008, Right click the project in the Solutions Explorer, and select Properties. From Application tab in that window you can select 'View UAC Settings'.

    As mentioned in the post I deleted, you probably are better off installing to the appropriate location for any OS situation.

  14. #14
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [RESOLVED] [2005] deleting

    You're writing to a directory that requires administrator access. This is unadvised unless you're developing a system utility that needs to access restricted folders. Instead, you should be writing to only user directories. There are temporary folders just for temporary data (which is what you appear to be deleting).
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  15. #15
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [RESOLVED] [2005] deleting

    Even though XP will allow you access to various places that Vista won't, that doesn't mean that you should use them. You should generally only be using folders that you can access through Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories. That gives you access to the Temp folder, My Documents, My Pictures, Application Data and the like. Those are really the only places that your application should need access to in the vast majority of cases.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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