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()
processinfo.UseShellExecute = True
processinfo.Verb = "runas"
Process.Start(processinfo)
Application.Exit()
No comments:
Post a Comment