Search This Blog

Showing posts with label Dotnet. Show all posts
Showing posts with label Dotnet. Show all posts

Tuesday, May 3, 2016

Auto Elevate DotNet Applications

Below code will check if the dotnet application is started as administartor. if not then it will auto elevate the application

processinfo = New ProcessStartInfo(Assembly.GetEntryAssembly().CodeBase)
            processinfo.UseShellExecute = True
            processinfo.Verb = "runas"
            Process.Start(processinfo)
            Application.Exit()