Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve current user in Windows
Message
From
16/03/2005 14:52:53
 
 
To
16/03/2005 11:34:13
General information
Forum:
ASP.NET
Category:
Security
Environment versions
Environment:
C# 1.1
OS:
Windows 2000 SP4
Network:
Windows NT
Database:
MS SQL Server
Miscellaneous
Thread ID:
00996379
Message ID:
00996482
Views:
15
You can also check to see if they can run the application and if so run the application using the users credentials by doing some like the following:
        <STAThread()> _
        Public Shared Sub Main()
            Try
                ' Assign current windows user to thread that runs the application
                AppDomain.CurrentDomain.SetPrincipalPolicy _
                (System.Security.Principal.PrincipalPolicy.WindowsPrincipal)

                ' Verify current user membership in windows authentication
                ' security groups
                If System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated Then
                    If System.Threading.Thread.CurrentPrincipal.IsInRole("YOUR.COM\YourAppUsers") _
                    Or System.Threading.Thread.CurrentPrincipal.IsInRole("YOUR.COM\YourAppUsers") Then
                        Try

                            ' Instantiate the main application form
                            If result = DialogResult.OK Then
                                Application.Run(New MainForm)
                            End If

                        Catch e As Exception
                            ' Write the error to the application log
                            Something.Log.WriteException(e)

                            ' Display the Exception form
                            Dim ExceptForm As New mmExceptionForm(e.Message, e.StackTrace)
                            ExceptForm.ShowDialog()
                        Finally
                        End Try
                    End If
                End If...
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Previous
Reply
Map
View

Click here to load this message in the networking platform