C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Verify user credentials using API


Posted Date: 22 Jan 2008    Resource Type: Code Snippets    Category: Network

Posted By: Mohan Kumar       Member Level: Diamond
Rating:     Points: 10



Using this function we can verify user credentials.



[DllImport("ADVAPI32.DLL")]
public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword,
int dwLogonType, int dwLogonProvider, out int phToken);

const int LOGON32_LOGON_INTERACTIVE = 2;
const int LOGON32_LOGON_NETWORK = 3;
const int LOGON32_PROVIDER_DEFAULT = 0;
const int LOGON32_PROVIDER_WINNT50 = 3;
const int LOGON32_PROVIDER_WINNT40 = 2;
const int LOGON32_PROVIDER_WINNT35 = 1;

private bool isValidUser(string userName, string domainName, string passsWord)
{
bool Validateuser; int token1;
Validateuser = LogonUser(userName, domainName, passsWord, LOGON32_LOGON_NETWORK, 0, out token1);

if (Validateuser)
{
return true;
}
else
{
return false;
}
}






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Retrive the Free Space of a Network drive using C#
Previous Resource: Internet ConnectionStatus and NetworkConnection Type
Return to Discussion Resource Index
Post New Resource
Category: Network


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

UK Conference calling Company

Contact Us    Privacy Policy    Terms Of Use