In previous post talked about how to create an application that allows us to manage user access now see how we can use the ASP membership service. NET in a Windows Forms application that was what he was not available before.
1. Creating the Client application
Let's create a simple Windows Forms application as shown in the image:
As this is only illustrative not need to create a complex application.
2. Linking
ServiceNow we will integrate the service they had created previously to make use of validation users, for them we go to the project you just created and right click-> Properties, there we see the left side we have a Services tab, that's where you enable Client Application Services, the check mark and entered the data as shown in the image:
also must add a reference to System.Web in our project right click-> Add Reference on the NET tab look for the assembly and add it, this is for that we can use Class Membership in our application.
3. Validating Users
We will work in the form's Load event, within this will the following code to validate the credentials of a user if they are correct will be shown the form, otherwise it will display a message and close the application.
if (! Membership.ValidateUser ("User ", "Password ")) {
MessageBox.Show ("Invalid User ");
this . Close ();}
Now we can validate user data, even if belonging to validate a role, all that could be done in ASP. NET 2.0 in terms of users, now available for use by other applications, not only that, but also enables centralized user management.
was helpful I hope this post, if there was something that became clear, do not hesitate to leave your comments, also attached the example source code so they can review it.
0 comments:
Post a Comment