Scott Hanselman

dasBlonde

May 18, 2004 Comment on this post [0] Posted in ASP.NET | INETA | TechEd | Web Services | Speaking
Sponsored By

Wow, I can't believe I missed this.  Michèle Leroux Bustamante, INETA queen, .NET queen, Regional Director, closet-Canadian, has a blog - http://www.dasblonde.net (I'm still chuckling about the title.)

Everytime I see her publicity head shot, I think about redoing mine...or just using hers. 

Michèle is running the University of California San Diego's Web Services Interoperability Education Day just before TechEdTed Neward is Key Noting, and there will be a great Panel talk with John Bristowe, me, Joe Homnick, Joe Lindsay, Terry Mohn, and Ted Neward.

That's THIS Saturday at UCSD so check it out.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

A ridiculously huge Portland Nerd Dinner

May 18, 2004 Comment on this post [1] Posted in TechEd | ASP.NET | Tools
Sponsored By

Nerds descended upon the Washington Square Mall food court this evening for the May 18th Portland Nerd Dinner.  There had to be at least 40 people there. 

I was (fortunately or unfortunately) all suited up as I had been presenting to a visiting bank all day.  As you know, many Nerds see a suit only at Weddings and Funerals (and often not even then) so it caused quite the stir.

One kind gentleman who works for MSDN even said during the Q&A that "We don't take questions from Bible salesmen!"  I'd have fought him on the spot, but I'm just a tiny 42 Regular off the rack, and he'd likely crush my head. ;)

Anyway, it also marked the triumphant return of Rory to the NW - land of Birkenstocks and Socks.  He was in attendance with his always charming and considerably-better-half, Kori.  As he has given up colonial life he needs to have a post for us to trackback a 'blogosphere I-told-you-so' in the style of the "Sells TP." 

Chris was kind enough to bring down Shawn Morrissey, Kent Sharkey and a few other people who's names escape me although I've met them before.  After the dinner the MSDN team held a Q&A session.  You really have to give Microsoft credit for being sincerely interested in what the developer thinks.  They spent at least a half-hour talking about ways to make MSDN better before I had to go. 

No doubt something amazing happened after I left as is typical with these events.  Unless I literally hang out until the joint closes down, Rich Claussen always tells me the next day, "Dude!  You should have hung out!  Right after you left..."  Sigh.  I'm sure he'll post pictures of whatever I missed. :)

Seriously, go to the next Nerd Dinner whenever it may be.  It's turned into more than just a great networking event.  You really have to give Jim Blizzard credit for being one hell of a Developer Evangelist.  The concept is really taking off.  Russ Fustino (of Russ's Toolshed fame) is hosting the .NET Pub Club in the Gulf States district.  Fabulous.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Troy, the movie...and a new unit of measurement is born

May 14, 2004 Comment on this post [2] Posted in Movies
Sponsored By

The amount of energy required to launch one ship: One milli-helen.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

What a night...will it ever end?

May 14, 2004 Comment on this post [5] Posted in Musings
Sponsored By

Madness.  It's 1:39am. 

I went to Fry's this evening and spent some of my winnings.  I got a 10,000 RPM WDC 75 GIG SATA drive.  This is my first foray into Serial ATA.  I feel like the time I switched from MFM/RLL to IDE.  It's a whole new world out there.

I've got a lovely Intel 865PERL motherboard with SATA on the board itself - so theorectically I can run this new drive as my C: drive without any drivers (like you need with add-on SATA cards.)

Thing is, last week, thinking I was clever, I flashed the BIOS from the old version P12 to the new P15 - and I've been regretting it ever since. 

The machine boots like once every 12 reboots, and you have to power it off HARD and let it (the capacitors?) REALLY cool off.  It's madenning.  First I thought it was the old IDE Promise RAID card, then I thought it was an impending Hard Drive failure, then I thought it was a Firewire problem.  Now the box is opened up like a dissected High School frog and this is the only thing I can think it is.

I googled my BRAINS out trying to figure this out.  You know, there's a LOT of people out there on the USENET having hardware troubles! :)

I found this one guy who appeared to have the same problem.  And from the sound of it, we may just be the two people on the planet that are having this problem.

Anyway, I've removed this jumper and that, flashed the bios again with a recovery bios (copied onto the only 3.5" Floppy in the ENTIRE house, with some paper I wrote 12 years ago...I formatted it with impunity, so as to avoid catching some Word 2.0 Macro Virus, or a Stoned ANSI bomb).

It APPEARS to be booting up.  Now I begin the long process of designing a storage and backup strategy for this family!

I hope this BIOS sticks.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Accessing the ASP.NET FormsAuthentication "Timeout" Value

May 12, 2004 Comment on this post [3] Posted in ASP.NET | Internationalization | XML
Sponsored By

Here's a heck of a thing.  I'm doing my own FormsAuthentication Cookie/Ticket, rather then using the built in FormsAuthentication.RedirectFromLoginPage, as I need support for UserData, and other encrypted goodness.  So, I need to:

    // Create the authentication ticket            
            FormsAuthenticationTicket authTicket = new
                FormsAuthenticationTicket(1, //version
                userName, // user name
                DateTime.Now,             //creation
                DateTime.Now.AddMinutes(??), //Expiration
                false, //Persistent
                userDataGoodness); //Secret Sauce

but, I want to use the Timeout value that is already in the Web.config:

    <authentication mode="Forms">
            <!-- TODO: Set requireSSL to true for production -->
            <forms requireSSL="false"
                slidingExpiration="true"
                loginUrl="~/login.aspx"
                name="AuthenticationTicket"
                protection="All"
                timeout="20" />
        </authentication>

which seems reasonable, eh?  Plus, as I'm a nice guy (hopefully not a hack) I like to do things the Kosher way.  I'd had to hack this up.  So, I figure I'll use something like 'FormsAuthentication.Timeout' - except it doesn't exist.  I can get to everything else, just not the Timeout.

And the Googling and Reflecting begins.  Sometimes I think that's my full time job, Googling and Reflecting.

Here's my thought process, for your edutainment:

  • THOUGHT: Surely they must have thought about this.
  • ANSWER VIA GOOGLE: In a 2002 MSDN Online Chat, someone asked this question and was told: “Unfortunately, we don't expose this configuration property currently.“ but given these helpful tips:
    1. You could try reading it using System.Management
      (ME: But this would require giving WMI access to ASP.NET and doing something like:

      string path = "root\\NetFrameworkV1:forms";
      ManagementObject pm = new ManagementClass(path).CreateInstance();
      pm["Selector"] = "config://localhost"; // represents the machine.config file
      pm.Get();
      Response.Output.WriteLine("timeout = {0}<br>", pm["timeout"]);

      Yuck.)
    2. You can retrieve the value you set by casting User.Identity to an instance of FormsIdentity and accessing the fields on that object.
      (ME: This only allows me to see the result AFTER I've already set it once.  I need this to work the first time, and I'd like to read it as a configuration item, not a side effect.

  • THOUGHT: Someone on Google Groups must have done this before.
  • ANSWER FROM GOOGLE GROUPS: Noone has a clue, but many have hacked things worse that my upcoming hack. NOTE: Don't do this, and remember Scott's Rule of Programming 0x3eA)
    1. Private Function TimeOut_Get() As Integer
      'Get formsauthentication TimeOut value
      'Kludge, timeout property is not exposed in the class
      FormsAuthentication.SetAuthCookie("Username",
      False)
      Dim ticket As FormsAuthenticationTicket =
      FormsAuthentication.Decrypt(Response.Cookies
      (FormsAuthentication.FormsCookieName).Value)
      Dim ts As New TimeSpan(ticket.Expiration.Ticks -
      ticket.IssueDate.Ticks)
      Return ts.Minutes
      End Function

  • THOUGHT: I could just put the configuration somewhere else in my web.config and let folks keep the two in sync.
  • ANSWER FROM MY CONSCIENCE: That would mean that there would be invalid states if they didn't match.

Note, here's where insanity and over engineering set in...

  • THOUGHT: I can just use HttpContext.GetConfig and read it myself.
  • ANSWER VIA REFLECTOR: AuthenticationConfig and all it's properties are internal.

  • THOUGHT: I can use Reflection and read the privates myself. 
    Remember, Relector and a little Red Wine will always give you access to Private Members.
  • ANSWER VIA MY CONSCIENCE: I don't really want to Reflect my way to salvation

  • THOUGHT: Screw it, let's just SelectSingleNode once and feel back for 10 minutes.
  • ANSWER:

                System.Xml.XmlDocument x = new System.Xml.XmlDocument();
                x.Load(UrlPath.GetBasePhysicalDirectory() + "web.config");
                System.Xml.XmlNode node = x.SelectSingleNode("/configuration/system.web/authentication/forms");
                int Timeout = int.Parse(node.Attributes["timeout"].Value,System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

I know it could be better, but I'll put it in a constructor, add some error handling and move on. All this thinking only took about 20 minutes, so don't think I spent the afternoon sweating it.  More time was spent on this post! :)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.