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. .NET (Core and Framework)
  4. How to know user rights

How to know user rights

Scheduled Pinned Locked Moved .NET (Core and Framework)
helptutorial
3 Posts 2 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.
  • S Offline
    S Offline
    Sreepathi
    wrote on last edited by
    #1

    Hi, I would like to know the Administrator Rights are there are not for the current user. My application gives the computer name etc., when the user runs on his machine, at the same time I would like to know whether the user have Administrator rights or not. Can any one help me. Thanks, Sreepathi Sreepathi

    R 1 Reply Last reply
    0
    • S Sreepathi

      Hi, I would like to know the Administrator Rights are there are not for the current user. My application gives the computer name etc., when the user runs on his machine, at the same time I would like to know whether the user have Administrator rights or not. Can any one help me. Thanks, Sreepathi Sreepathi

      R Offline
      R Offline
      Roman Rodov
      wrote on last edited by
      #2

      using System.Security.Principal; using System.Threading; ... ... ... WindowsPrincipal winId = (WindowsPrincipal)Thread.CurrentPrincipal; bool isAdmin = winId.IsInRole(WindowsBuiltInRole.Administrator); bool isPowerUser = winId.IsInRole(WindowsBuiltInRole.PowerUser);

      S 1 Reply Last reply
      0
      • R Roman Rodov

        using System.Security.Principal; using System.Threading; ... ... ... WindowsPrincipal winId = (WindowsPrincipal)Thread.CurrentPrincipal; bool isAdmin = winId.IsInRole(WindowsBuiltInRole.Administrator); bool isPowerUser = winId.IsInRole(WindowsBuiltInRole.PowerUser);

        S Offline
        S Offline
        Sreepathi
        wrote on last edited by
        #3

        Hi Roman Rodov and all, It doesn't work for me. Giving an error saying that the Specified cast is not valid. Thanks, Sreepathi. Got it Thanks....

        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