Search This Blog

Tuesday 8 September 2009

Use the tools Bill gave us!

I've been looking at ASP.Net authorisation techniques over the last few days, and am now absolutely kicking myself that I didn't look at them when I first started ASP.Net development 3 years ago.

It turns out that .Net framework V2 gives you lots of tools to do this for you, and that they are ridiculously easy to use.

The System.Web.Security namespace contains a few extremely useful tools, and (combined with some Googling) it is very easy to set password complexity, access to folders and all manner of other things that you would expect an Authentication method to provide.

This namespace has two extremely useful classes in it;
  • Membership
  • Roles
Membership allows you to perform user operations, like adding, deleting updating and validating.

Roles allows you to create/delete roles, and add/remove users to/from them. This is mostly using shared methods and a built in and automatically configured database. I.e. you don't have to think about it!

The main problem I now face is how best to resturcture the application so that style sheets work properly, as well as links to images, screens etc. This would have been laid out a lot differently had I known about ASP.Net Forms authentication when I started building the application!