Writing the Membership User Control

After much searching, I found this great article on how to write your own User Control. This is a good way to get started, but there were a couple of snags you should be aware of:

1. Start by creating a completely new Visual Studio ASP.NET Web Application. You should not be adding your user controls to existing projects, as you end up with a mess of DLL's, so start cleanly from scratch.

Note:  There is a difference between an ASP.NET User Control, and an ASP.NET Custom Control. This article from Microsoft explains it in great detail. I believe I noticed several forum posts and articles on the web that managed to confuse the two.

2. Follow the instructions in the article mentioned above.

3. After doing this, I managed to get my new user control running, with the following snag... It works in the umbraco templates, but NOT in the umbraco content files. Worse, the generated error actually 'spills over' into the umbraco management forms, causing the umbraco UI itself to be rendered wrong. Now, let's see if the forum can help (Everyone says the forum is fantastic)...

My post to the forum

Result: It turns out umbraco does not work so well with Firefox, which means I will have to do all my umbraco work in IE. I shall cry on the inside while moving on... (And hope version 4 solves this).

Tip: To make life easier, Firefox has a several great add-ons that will automatically load IE for the pages you select. I use IE View myself. When browsing to an 'IE' page, it automatically launch IE with the page requested. This, by the way, is also reason #772 to love Firefox.  

4. The next step for my membership control, is to contact my server (Which runs on another machine), and login to the account. This requires a web-service call (Done inside my user control). Testing my user control on my real site, I ensure it works, but simply plugging it into umbraco does not (for debugging purposes I show an error value logging in).

It turns out that this required WSE3 services to work, which I have described in another chapter.

5. Now, my User Control performs a FormsAuthentication.RedirectToLoginPage()  function call to work. This, in turn, requires SSL (HTTPS) to work, so the next step is to enable HTTPS for some of my pages. This is described in this exciting chapter (full of intrigue and suspense).

I have yet to apply this solution and test it out... stay tuned..

Explore the coming Umbraco 4

Brilliant umbraco hosting provided by FAB-IT