Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

Archives

August 2004 - Posts

Today's documentationless experiment: Writing a ProfileProvider

Writing a Membership provider sure was easy, but wow is the documentation a bit thin for writing a Profile provider. I've started with the GetPropertyValues() method. So far I've got this bit working in a class called PopForumsProfileProvider, which inherits the abstract base class ProfileProvider:

public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection ppc)
{
 HttpContext.Current.Trace.Warn(context.ToString());
 string s = ppc.ToString();
 HttpContext.Current.Trace.Warn(s);
 SettingsPropertyValueCollection settings = new SettingsPropertyValueCollection();
 if ((bool)context["IsAuthenticated"])
 {
  People p = new People(context["UserName"].ToString(), PeopleLookupType.Name);
  SettingsPropertyValue list = new SettingsPropertyValue(ppc["PopForums.List"]);
  list.PropertyValue = p.List;
  settings.Add(list);
 }
 else throw new Exception("PopForums Profile provider: User is not currently authenticated.");
 return settings;
}

And in web.config...

<profile>
 <providers>
  <add name="PopForums" type="PopForums.Security.PopForumsProfileProvider, PopForums" />
 </providers>
 <properties>
  <group name="PopForums">
   <add name="List" type="System.Boolean" provider="PopForums" />
  </group>
 </properties>
</profile>

People is a class from my forum that manages user data. So far, this works like a champ. It took some debugging and poking around to figure out what the hell those two parameters were because the docs don't actually say at the moment.

The trick now is figuring out where in the page's event life cycle the SetPropertyValues() method of the provider is called. I guess it's not essential to know, but I would like to.

The other thing that I'm curious to know is how the default provider (which will be SqlProfileProvider in beta 2) iterates through the property collection. In the above code, I couldn't figure out exactly how to figure out what the property names were in ppc.

Posted: Aug 31 2004, 01:55 AM by Jeff | with 1 comment(s)
Filed under: ,
Themes and CSS in ASP.NET v2

I've been playing a little with the themes in v2 and I've changed my opinion on them. When I first learned about the basic capabilities of themes I kind of shrugged it off as a, "That's neat, I guess."

My opinion has changed because I didn't realize that a theme applied to a page will drop links to every style sheet from the theme's folder into the <head> of the document. That's really useful. I still don't see control declarations in .skin files as particularly useful, with the exception of applying the CssClass attributes to certain complex controls (like the calendar), but the basic theme capability is cool.

Yet another cool feature I can't wait to use in real life.

Posted: Aug 30 2004, 08:41 PM by Jeff | with no comments
Filed under:
SQL Express and ASP.NET v2: wow!

Scott Guthrie pointed me in the right direction in my last post regarding the use of SQL Express databases in ASP.NET v2. What I thought most incredible was that in e-mail he said that a box with SQL Express on it will create a database file in your /data folder, ready to go, for Membership, Profile and such, just as it did with the Access provider (which is going away for beta 2)! How cool is that?

The thing that surprises me the most is that SQL Server 2005 Express is going to be free, and its own really substantial limitation (if I'm reading the specs right) is the 4 gig cap on databases. This lifts yet another barrier for people that think using Microsoft's platform is too expensive. Well done!

Posted: Aug 30 2004, 09:40 AM by Jeff | with no comments
Filed under:
Need help on SQL Express using file in /data

It's my understanding that since the Access providers are going away in .NET v2 that the SQL providers will be the default. However, and correct me if I'm wrong, they won't generate a database file for Membership, Profile, etc., the way that the Access provider did in the /data folder, right?

What is the procedure then to create a file-based SQL Express database for the same purpose? What does the connection string look like? The idea of an xcopy-able SQL database sure has me sold (it's plugged as a major feature of SQL Express), but the docs are a little thin at the moment. I have no problem specifying the SQL providers in web.config, but setting a connection string and creating the database are two areas I'm a little unclear on.

Posted: Aug 29 2004, 02:29 PM by Jeff | with 1 comment(s)
Filed under:
Gmail must be ready to ramp up
In the last week, I think I've had at least ten invites to give away from Gmail. I get the distinct impression that they're either pushing another level of traffic for testing purposes or they're considering going live soon. There are so many accounts out there now that it's not nearly as cool or "in" as it used to be to use Gmail!
Posted: Aug 29 2004, 01:04 PM by Jeff | with 2 comment(s)
Filed under:
Slipping schedules aren't good for anyone

It appears that Longhorn is going to be less than we had hoped for. According to News.com, some features will be left out just so they can finally get it out the door. Personally, I don't care that much, but I know the Windows developers that have been working with the alphas are disappointed.

.NET v2.0 seems to be on a mystery schedule as well. It's great that we have beta 1, but I think people are hungry now for beta 2, especially Visual Studio 2005. Microsoft's openness in this development is a real double-edged sword. On one hand, they've got people excited about the new product, but on the other hand, it opens them up to criticism when schedules keep on slipping.

My position isn't a toddler's "I WANT!" cry. I can get along fine without .NET v2.0. It's the tool, Visual Studio, that I need. Why? Because every time I go back to using VS 2003 for production work, I realize just how broken it is. I have to revert to my defensive coding to keep VS from mangling everything I do.

To be truthful, I don't care when v2.0 is finally released. To Microsoft's credit, the beta is stunning in terms of stability, and it would easily meet my needs in production today. I'll be perfectly happy with that "go live" license when it comes around with beta 2. That can't come soon enough.

Posted: Aug 27 2004, 03:34 PM by Jeff | with 2 comment(s)
Filed under:
An introduction to posting in forums
If you run a forum, you know how annoying new users can be. Here's the single best "instructional video" I've ever seen on the subject. Watch it... you'll laugh your ass off.
Posted: Aug 27 2004, 09:29 AM by Jeff | with no comments
Filed under: ,
ParameterizedThreadStart: Good call!

I just noticed that a new overload of the Thread constructor was added to .NET v2, accepting a ParameterizedThreadStart object. Cleverly enough, it allows you to call the thread's Start() method with a parameter to pass in to the method you're firing in its own thread. I don't understand why that wasn't there from the start, but good call!

Posted: Aug 25 2004, 02:25 AM by Jeff | with 2 comment(s)
Filed under:
Search for "http" on Google

I was trying to remember if the second "T" in HTTP stood for "transfer" or "transport," because let's face it, even code monkey geeks don't think about it every day. To find out, I typed it into Google because of their convenient link to the definition.

What was interesting was the search results. Ranked first among the 576 million results was Microsoft, followed by AltaVista, Yahoo, the W3C, Excite, Lycos, CNN, Amazon, the Merriam-Webster dictionary, Mapquest, Adobe, Go.com, Dogpile, Netscape, the World Health Organization, Google itself, Metacrawler, The New York Times, Real Networks and finally, The Internet Movie Database.

Interesting top 20 search for "http." Any guesses on how it arrives at that result?

Posted: Aug 24 2004, 11:01 PM by Jeff | with 6 comment(s)
Filed under:
Access vs. SQL Express providers in ASP.NET v2

I noticed that the Access providers for Membership and such won't be there, or am I reading that they just won't be the default providers?

It doesn't actually matter to me, but I'm trying to get my book finished and I'd like to at least take a reasonable stab at getting it right. Sure, I've got disclaimers here and there about what was for real in beta 1, but I'd like to get that up to beta 2. Now I see what authors mean about the pains writing for a product that isn't final yet.

I noticed in Shanku's blog that they want to substitute the Access providers with SQL Express. I have to admit I haven't even installed that product yet. You can move a database as a file? Anyone see a good article on that?

Posted: Aug 23 2004, 05:44 PM by Jeff | with 2 comment(s)
Filed under:
More Posts Next page »