CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    UAC issues and permissions

    Hi,
    I have an application that I wrote with VB.Net 2008
    This application needs to use drag and drop, File IO actions.
    Lately I noticed a problem with it when the UAC (User Access Control) is turn on (On its default mode)
    I use to copy a file to a folder that I create at:
    Code:
    System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
    But when I want to delete this file I get an error about access is denied.

    I try to run the application as administrator and this actually solve the issue but then the drag and drop not working.

    Can someone help me to find a solution for each problem:
    1. How to avoid such of access denied issues.
    2. If run as administer why the drag and drop not working?


    thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Re: UAC issues and permissions

    Any one?

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: UAC issues and permissions

    What do you think SpecialFolder. means? You could search on Microsoft's site for the formal definition, but, it isn't complicated. You can't delete files that you don't own...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Re: UAC issues and permissions

    Thanks, OK
    Which folder \location you suggest i will use in order to be able deleting files?

    Thanks, OK
    Which folder \location you suggest i will use in order to be able deleting files?
    I checked it with few locations and its always act the same so i guess i cannot delete the files i want to. let me explain what my application do:
    1. Open from file or Drag and drop a PDF file to my application
    2. I save the given PDF in to a temp location
    3. The application use 3rd application to convert the PDF in to images for each page
    4. My application save these images in a database
    5. Now i need to delete all the images and the PDF from the temp location


    Now i must clear this temp folder from all the files that i don’t need any more how can i do that?
    If i run as admin i will lose the drag and drop option.

    How can i do that right?
    Last edited by leeshadmi; December 2nd, 2012 at 04:34 AM.

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: UAC issues and permissions

    add a manifest to your software where you stated admins right si required. This will bring out the "confirm you want the software do this", and in case user has not, it would ask for Admin pwd.
    ie: http://msdn.microsoft.com/en-us/library/bb756929.aspx
    and http://msdn.microsoft.com/en-us/libr...v=vs.100).aspx
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Re: UAC issues and permissions

    Thanks but i already try that and it works with the delete file process but then the drag and drop will not work.
    I read about this issue on the net and i understood that its because the files comes from not admin application (Windows explorer) and my application run as admin and thats why the "Run as " option for my application is not good for me.
    Maybe the solution will be another application that just delete the folder and run as admin, i dont know i just dont like this idea.
    Isnt any other way to make my application to be able to delete files? maybe some folder that have no security on it some where in the drive?

  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: UAC issues and permissions

    Is it a click once application? You could try with isolated storage (ie: http://msdn.microsoft.com/en-us/libr...v=vs.100).aspx ) but that would make hidden to you too the exact location of those files on machine...
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Tags for this Thread

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

Featured