In this tutorial we will explore ASP.NET's Login Control and also briefly go over creating user accounts so that we can test our Login Control.
Adding the Login Control
I have created a new ASP.NET Empty Website in Microsoft Visual Web Developer and have added a blank Web Form to my website. To add our Login Control, open up your Web Form into Design mode and expand the Login tab in your toolbox. This will show us all of the ASP.NET Login Controls. Then, drag and drop a Login Control onto your Web Form.
What you see now is a default ASP.Net Login Control, which should look pretty similar to every other Login you have seen with the simple User Name and Password Text Boxes, the Login button, and by default they even have a 'Remember me next time' Check Box. If you run the program you will be able to interact with the Login control, but we will not really be able to test it until we actually have a User Account to login to.
If you're looking for a really good web host, try Server Intellect - we found the setup procedure and control panel, very easy to adapt to and their IT team is awesome!
Creating a New AccountWhat we are going to do here is very quickly create a User Account so that we can test this Login Control that we have added. In order to do this we need to load up the ASP.NET Website Administration Tool, in order to do this:
- In your Solution Explorer find the ASP.NET Configuration icon at the top and click it.
- You should now be viewing the ASP.NET Website Administration Tool. Here we will want to click on the Security tab.
- Next, we want to change our current authentication type to enable the creation of users. Under the Users heading, click the Select authentication type link.
- On this page we will want to change the option From local network, which does not allow us to create users, to From the internet which will allow us to do so. Go ahead and select the Radio Button next to From the internet and then click Done.
- Back at the Security page, you will notice that the Users heading has been changed to reflect the current number of users, and now contains two more links for Create Users and Manage Users. We will want to click Create Users.
- Now at the Create User page, we will want to fill out the appropriate information to make a User Account here. Leaving all of the other options default, complete the form and create a user that we will use to test our Login Control. (Note: This form requires a secure password by default containing non-alphanumeric characters. These settings can be changed, but that is outside the scope of this tutorial.) With the appropriate information filled out, click Create User.
- You should see a confirmation page after the User Account is created. With our User Account created, go ahead and close the ASP.NET Website Administration Tool.
We migrated our web sites to Server Intellect over one weekend and the setup was so smooth that we were up and running right away. They assisted us with everything we needed to do for all of our applications. With Server Intellect's help, we were able to avoid any headaches!
TestingNow we want to go ahead and test this out by loading up the Web Page that you added the Login Control to. It is important to understand that our current website doesn't have any sort of content to display after a successful login, so we will test this by first entering incorrect login information and then entering a correct username/password. To test this:
- Enter a fake Username and Password like fake/fake and click Login. (Note: We use a fake username and password here because attempting to login with no information in the Login Control will show a simple error indicating that the Username and Password fields require data.)
- You should see an error message that looks like this:
- Now enter the Username and Password that you created with the ASP.NET Website Administration Tool and click Login.
- If the login is successful you will not see an error message, which tells us that our Login Control is working!
I just signed up at Server Intellect and couldn't be more pleased with my Windows Server! Check it out and see for yourself.
The Web Form source looks like this: <body> |
No comments:
Post a Comment