Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Obtaining Administrator Authority

Obtaining Administrator Authority

Scheduled Pinned Locked Moved C#
questiondatabase
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gmhanna
    wrote on last edited by
    #1

    Hi, I'm writing an application where I need administrator authority to create the database. I do not want to run as an administrator the entire time, just to create the file. How do I switch into Administrator mode and switch back? I know the User will get a prompt when trying to do this as I have seen other applications requesting administrator authority. Thank you,

    Glenn

    D D P 3 Replies Last reply
    0
    • G gmhanna

      Hi, I'm writing an application where I need administrator authority to create the database. I do not want to run as an administrator the entire time, just to create the file. How do I switch into Administrator mode and switch back? I know the User will get a prompt when trying to do this as I have seen other applications requesting administrator authority. Thank you,

      Glenn

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Unless something has changed that I don't know about, you cannot switch back and forth. It's the entire process runs with admin priv's or nothing.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      • G gmhanna

        Hi, I'm writing an application where I need administrator authority to create the database. I do not want to run as an administrator the entire time, just to create the file. How do I switch into Administrator mode and switch back? I know the User will get a prompt when trying to do this as I have seen other applications requesting administrator authority. Thank you,

        Glenn

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        As Dave said - AFAIK you can't. You can create separate process to do the DB stuff and start that with elevated privileges though. Google "start new process with elevated privileges" and you will find many results.

        Dave
        Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

        1 Reply Last reply
        0
        • G gmhanna

          Hi, I'm writing an application where I need administrator authority to create the database. I do not want to run as an administrator the entire time, just to create the file. How do I switch into Administrator mode and switch back? I know the User will get a prompt when trying to do this as I have seen other applications requesting administrator authority. Thank you,

          Glenn

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          I prefer to include an empty copy of the database with the app.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups