0

hi there,

i have a desktop application that in visual studio 2008 standard edition in C#.currently i have a userlogin in the mdf file and when login in to the system. what i want is to make the windows credinals in to use. how can i upgrade my application so that when the users clicks the login button in the desktop application if the windows username and the password are correct, how to i let the user to login to the desktop application. how can i make this.


thanxxxxxxxx

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by nick.crane
0

If the user successfully logged in then just add the program to startup.

System.Environment.UserName
0

If the user successfully logged in then just add the program to startup.

System.Environment.UserName

is this the only code that i have to add.

how is this done.when the windows user login is successful how can i check the usernsma and password and check and let the desktop application to login. please can u explain the procedure or the steps in this situation??


thanxxxxxxxxxx

0

If you intend to use your own DB of username and password then you must create you own login form and test the entered values against those stored in your DB.

If you intend to use the Windows login credentions to validate access to your application then this is much more complicated to do.
You will need to investigate the objects in the System.Security.Principal namespace. Particularly the IIdentity and IPricipal interfaces.
And also know how to properly use the LogonUser fuction in advapi32.dll (below).

[DllImport("advapi32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword,
            int dwLogonType, int dwLogonProvider, ref IntPtr phToken);

Edited by nick.crane: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.