ASP.NET 2.0 Providers Source Code and Whitepapers, "Safe" method versions

If you have an interest in both using and extending the existing ASP.NET 2.0 Provider model as I do, then you'll be pleased to find out that the full source code for the ASP.NET built-in providers has been released in a nice Visual Studio.NET buildable solution here.

In addition, Jeff Prosise has some 130 pages of whitepaper info on all this stuff here.

Up until now, there was some spotty information on blogs and sample submissions, but this is the first time I've seen everything nicely packaged up "under one roof".

I particularly enjoyed writing custom SQLite Membership and Role Providers, as well as some current work I'm doing on a searchable Profile Provider (e.g., give me all the members who have X, Y and Z). So this is a welcome addition.

This is one part of ASP.NET 2.0 that they got right IMHO.

For reference purposes, here is a link to Scott's original blog post:

Safe Method Versions

Do you ever have some coding issue or requirement that kinda annoys you but you keep going along doing it anyway? I think it would be nice if somebody assembled all this little boogers and put together some sort of utility library for it. I'd sure use it.

I'm talking about things like checking for null values on the QueryString before attempting to use a key. The helper method for that one might be something like this:

public static string SafeGetQueryString(string key)
HttpContext ctx = HttpContext.Current;
if(ctx.Request.QueryString["key"}==null) return String.Empty;
return ctx.Request.QueryString["key"];

-- any required null or other testing would be performed automatically in the method body. I've seen developers make methods like "SafeParseInt" and "SafeIsMACAddress"... Of course in VB.NET a lot of this stuff is done for you under the hood; that's why there is so much room for abuse. Just leave Option Strict and Option Explicit set to "Off" and "code away, Mamma!". Looky here! Everything's an Object anyway, what the hayle do we need to declare and type 'em fer?

Are you up for this, man? Hi, it's [URGENT]. Please send me the answer right away!


  1. Anonymous4:43 AM

    hi there,
    i`ve read youre working on a searchable custom profile provider..
    can you give me directions on developing one myself, or code? :) thanks in advance

  2. You can do this with the SqlTableProvider and the SqlStoredProcedureProvider. Both samples can be found on Scott Guthrie's blog. You will be using a table of your own design for the provider details, so it can be searched like any other database table. BTW, you will get more mileage on questions if you post them to the forums.


Post a Comment

Popular posts from this blog

ASP.NET: Loss of Session / Cookies with Frames

Effectively Promoting your Blog (or WebSite)