In this tutorial we will explore ASP.NET's LoginName Control and have it display our Username once we login.
Adding the LoginName Control
At this point in the tutorial 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 LoginName Control, open up your blank Web Form into Design mode and:
Expand the Login tab in your toolbox. Drag and drop a LoginName Control onto your Web Form.
Try Server Intellect for Windows Server Hosting. Quality and Quantity!
What you should see now is the LoginName Control that looks like:
Go ahead and load up your website. You'll notice that your LoginName Control is currently displaying your Windows Username. This is because we are currently using Windows authentication, which we will need to change to enable user account creation.
Adding the Login Control
In order for us to test our LoginName Control and demo how it works, we will need to be able to login to an account on our website. To do this, we must first add a Login Control:
Expand the Login tab in your toolbox. Drag and drop a Login Control onto your Web Form underneath our LoginName Control.
We used over 10 web hosting companies before we found Server Intellect. Their dedicated servers and add-ons were setup swiftly, in less than 24 hours. We were able to confirm our order over the phone. They respond to our inquiries within an hour. Server Intellect's customer support and assistance are the best we've ever experienced.
Creating a New AccountNow that we have everything on our Web Form setup, we need to enable user creation and actually create a new User Account to test this. To do this:
- Click the ASP.NET Configuration icon in the Solution Explorer to open up the ASP.NET Website Administration Tool.
- In the ASP.NET Website Administration Tool click the Security tab.
- Under the Users header click the Select authentication type link.
- Select From the internet and click Done. This will enable the creation of users and also stop the LoginName Control from using your Windows Username. Instead, it will now use the username of an account that is signed in through our Login Control.
- Under the Users header click the Create Users link.
- Create a new user and click Done.
- Close the ASP.Net Website Administration Tool.
Now that we are all setup, to test this out:
- Load up your website and notice that instead of displaying your Windows Username, now the LoginName Control is blank. This is because we have not yet logged in.
- Login using the account you made earlier.
- Notice that the LoginName Control now displays the Username you logged in with.
Need help with Windows Dedicated Hosting? Try Server Intellect. I'm a happy customer!
The source of the Web Form: <body> |
No comments:
Post a Comment