<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://chriskirby.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Chris Kirby&amp;#39;s Inner Monolog : Hacks</title><link>http://chriskirby.net/archive/tags/Hacks/default.aspx</link><description>Tags: Hacks</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>My dell widescreens go vertical</title><link>http://chriskirby.net/archive/2006/08/08/My-dell-widescreens-go-vertical_5F00_180.aspx</link><pubDate>Tue, 08 Aug 2006 18:35:02 GMT</pubDate><guid isPermaLink="false">fe7bf805-78e2-48d4-8999-041f23e860c0:206</guid><dc:creator>Chris Kirby</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/rsscomments.aspx?PostID=206</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/commentapi.aspx?PostID=206</wfw:comment><comments>http://chriskirby.net/archive/2006/08/08/My-dell-widescreens-go-vertical_5F00_180.aspx#comments</comments><description>&lt;!-- Generated by XStandard version 1.7.0.0 on 2006-08-08T11:57:59 --&gt;&lt;p&gt;I may be marginally insane, but once i saw &lt;a href="http://ergotron.com/ProfessionalProducts/DeskMounts/tabid/71/ctl/Product/mid/396/PRDID/15/Default.aspx" target="wookie_new"&gt;this stand&lt;/a&gt;, I had to have it.&lt;/p&gt;&lt;p&gt;&lt;a href="http://dotnetwookie.com/photos/chris_kirby_photo_gallery/picture1176.aspx"&gt;&lt;img alt="dual monitors" src="http://dotnetwookie.com/photos/chris_kirby_photo_gallery/images/1176/secondarythumb.aspx" style="border:0;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Sometimes these 20&amp;quot; widescreens can take up a little too much horizontal real estate...So, what better solution then to stack em' high ;) Now I guess its time to add that &lt;a href="http://accessories.us.dell.com/sna/productdetail.aspx?c=us&amp;amp;l=en&amp;amp;s=dhs&amp;amp;cs=19&amp;amp;sku=320-4335" target="wookie_new"&gt;24&amp;quot; widescreen&lt;/a&gt; in portrait mode to the right!&lt;/p&gt;&lt;img src="http://chriskirby.net/aggbug.aspx?PostID=206" width="1" height="1"&gt;</description><category domain="http://chriskirby.net/archive/tags/Hacks/default.aspx">Hacks</category><category domain="http://chriskirby.net/archive/tags/Hardware/default.aspx">Hardware</category><category domain="http://chriskirby.net/archive/tags/Personal/default.aspx">Personal</category><category domain="http://chriskirby.net/archive/tags/Reviews/default.aspx">Reviews</category><category domain="http://chriskirby.net/archive/tags/Tech/default.aspx">Tech</category></item><item><title>Asp.net 2.0 membership and migrating legacy users</title><link>http://chriskirby.net/archive/2006/06/21/Asp.net-2.0-membership-and-migrating-legacy-users_5F00_174.aspx</link><pubDate>Wed, 21 Jun 2006 16:07:00 GMT</pubDate><guid isPermaLink="false">fe7bf805-78e2-48d4-8999-041f23e860c0:200</guid><dc:creator>Chris Kirby</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/rsscomments.aspx?PostID=200</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/commentapi.aspx?PostID=200</wfw:comment><comments>http://chriskirby.net/archive/2006/06/21/Asp.net-2.0-membership-and-migrating-legacy-users_5F00_174.aspx#comments</comments><description>I've encountered many instances lately in which i'm developing a new version of a site with an existing (custom) authentication database. Now, in cases like these, most .net developers would suggest writing your own membership and role providers to tie directly in to the existing schema; however, instead of rolling my own, I've decided to take a different approach in which I simply utilize the events provided with the login control to manually authenticate and migration the legacy accounts in real time. This approach requires considerably less code and allows you to utilize the default providers while still supporting the legacy user database. The event code would look something like this: (*note* that the db code makes use of classes and methods from a custom library)
&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;void&lt;/span&gt; Login1_Authenticate(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;object&lt;/span&gt; sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
{ &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// first, check to see if the user has already been migrated. if so, then were done here.&lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt;(Membership.ValidateUser(Login1.UserName, Login1.Password))
{
e.Authenticated &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt;;
}
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;
{
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// check legacy credentials&lt;/span&gt;
DataParameters parameters &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; DataParameters();
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@Login"&lt;/span&gt;, SqlDbType.VarChar, Login1.UserName);
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@Password"&lt;/span&gt;, SqlDbType.VarChar, Login1.Password);
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@Email"&lt;/span&gt;, SqlDbType.VarChar, 50, ParameterDirection.Output);
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@UserId"&lt;/span&gt;, SqlDbType.Int, 1, ParameterDirection.Output);
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ReturnValue"&lt;/span&gt;, SqlDbType.Int, 1, ParameterDirection.ReturnValue);
DataUtility.ExecuteNonQuery(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ConnectionString"&lt;/span&gt;, CommandType.StoredProcedure, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ValidateUser"&lt;/span&gt;, parameters);
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// if the credentials are good, then migrate to membership&lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt;((&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;int&lt;/span&gt;)parameters[&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ReturnValue"&lt;/span&gt;].Value == 0)
{
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// migrate the user account&lt;/span&gt;
MembershipCreateStatus status;
MembershipUser newUser &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Membership.CreateUser(Login1.UserName, Login1.Password, parameters[&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@Email"&lt;/span&gt;].Value.ToString(), &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"What is your Username?"&lt;/span&gt;, Login1.UserName, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;out&lt;/span&gt; status);

&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;if&lt;/span&gt; (status == MembershipCreateStatus.Success)
{
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// update legacy user with new membership user id, tying the old to the new&lt;/span&gt;
parameters &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;new&lt;/span&gt; DataParameters(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@UserId"&lt;/span&gt;, SqlDbType.Int, Login1.UserName);
parameters.Add(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"@MembershipUserId"&lt;/span&gt;, SqlDbType.UniqueIdentifier, newUser.ProviderUserKey);
DataUtility.ExecuteNonQuery(&lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"ConnectionString"&lt;/span&gt;, CommandType.StoredProcedure, &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"UpdateUser"&lt;/span&gt;, parameters);
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Create an empty Profile for the newly created user&lt;/span&gt;
ProfileCommon profile &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; (ProfileCommon)ProfileCommon.Create(Login1.UserName, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;);
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Populate default profile values&lt;/span&gt;
profile.Theme &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"Default"&lt;/span&gt;;
&lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;// Save the profile&lt;/span&gt;
profile.Save();
e.Authenticated &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;true&lt;/span&gt;;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;return&lt;/span&gt;;
}
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;else&lt;/span&gt;
Login1.FailureText &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"We were unable to migrate you user account. Please contact support for further assistance."&lt;/span&gt;;
}
e.Authenticated &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;false&lt;/span&gt;;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;So, with the little bit of code above, I'm able to authenticate and migrate legacy user accounts to the new membership system without breaking the existing db schema. It may not be as elegant as writing your own provider, but in my case, it was equally as effective.&lt;/p&gt;&lt;img src="http://chriskirby.net/aggbug.aspx?PostID=200" width="1" height="1"&gt;</description><category domain="http://chriskirby.net/archive/tags/.Net/default.aspx">.Net</category><category domain="http://chriskirby.net/archive/tags/Hacks/default.aspx">Hacks</category><category domain="http://chriskirby.net/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://chriskirby.net/archive/tags/OpenSource/default.aspx">OpenSource</category><category domain="http://chriskirby.net/archive/tags/Coding/default.aspx">Coding</category><category domain="http://chriskirby.net/archive/tags/Software/default.aspx">Software</category><category domain="http://chriskirby.net/archive/tags/cSharp/default.aspx">cSharp</category></item><item><title>The remodel/updating begins</title><link>http://chriskirby.net/archive/2006/05/26/The-remodel_2F00_updating-begins_5F00_168.aspx</link><pubDate>Fri, 26 May 2006 22:44:00 GMT</pubDate><guid isPermaLink="false">fe7bf805-78e2-48d4-8999-041f23e860c0:194</guid><dc:creator>Chris Kirby</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/rsscomments.aspx?PostID=194</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/commentapi.aspx?PostID=194</wfw:comment><comments>http://chriskirby.net/archive/2006/05/26/The-remodel_2F00_updating-begins_5F00_168.aspx#comments</comments><description>&lt;!-- Generated by XStandard version 1.7.0.0 on 2006-05-26T16:20:26 --&gt;&lt;p&gt;I just posted several &lt;a href="http://chrisjkirby.com/photos/chris_kirby_photo_gallery/category1028.aspx"&gt;new photos&lt;/a&gt; and &lt;a href="http://chrisjkirby.com/files/10/house_remodel_videos/default.aspx"&gt;videos&lt;/a&gt; of some of the demo and cleanup we started doing at the new house. To my surprise, we actually gutted enough stuff to completely fill up a 30 yard construction dumpster! &lt;a href="http://chrisjkirby.com/photos/chris_kirby_photo_gallery/category1028.aspx"&gt;Check em' out&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://chriskirby.net/aggbug.aspx?PostID=194" width="1" height="1"&gt;</description><category domain="http://chriskirby.net/archive/tags/Hacks/default.aspx">Hacks</category><category domain="http://chriskirby.net/archive/tags/Humor/default.aspx">Humor</category><category domain="http://chriskirby.net/archive/tags/Jackass/default.aspx">Jackass</category><category domain="http://chriskirby.net/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Moving to the GP</title><link>http://chriskirby.net/archive/2006/05/01/Moving-to-the-GP_5F00_163.aspx</link><pubDate>Mon, 01 May 2006 16:34:00 GMT</pubDate><guid isPermaLink="false">fe7bf805-78e2-48d4-8999-041f23e860c0:189</guid><dc:creator>Chris Kirby</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/rsscomments.aspx?PostID=189</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://chriskirby.net/commentapi.aspx?PostID=189</wfw:comment><comments>http://chriskirby.net/archive/2006/05/01/Moving-to-the-GP_5F00_163.aspx#comments</comments><description>&lt;!-- Generated by XStandard version 1.7.0.0 on 2006-05-01T10:43:18 --&gt;&lt;p&gt;In about 4 weeks Hayley and I will be leaving our condo in &lt;a href="http://www.downtownmountclemens.com/" target="wookie_new"&gt;The Clem&lt;/a&gt; and moving to our new house in &lt;a href="http://grossepointepark.com/" target="wookie_new"&gt;Grosse Pointe Park&lt;/a&gt;. Though I've said many times that I would never live in &lt;a href="http://grossepointe.com/" target="wookie_new"&gt;Grosse Pointe&lt;/a&gt;, I have to admit the houses there are pretty hard to match. The most enticing feature for me, after we began looking at these &lt;a href="http://www.thisoldhouse.com/toh/home" target="wookie_new"&gt;old houses&lt;/a&gt;, was their accessible 3rd level attic areas. And when I say accessible, I mean and actual door and staircase which lead up to 1 or more finished or unfinished rooms. Our new house has 1 finished room (10x14) and 1 unfinished on the 3 floor, which had me hooked right away. Now, to those who are familiar or who grew up in old houses, this may seem like nothing special; but, to those, like myself, who grew up in relatively new home or in the modern suburbs, having an accessible 3rd level is a whole new experience. For Hayley and I in particular, it has the unique benefit of allowing us to keep our home office (we both work from home) separate and on its own floor. 3rd level aside though, the house has many other cool amenities common to old homes, such as 80 year old red oak floors throughout, leaded glass windows on the exterior of the house as well as many of the doors in the home (most of these old houses have 1 or more doors for every room in the house), plaster walls, and radiator heat throughout.&lt;/p&gt;&lt;p&gt;Now, with that said, all that charm definitely comes at a price ;). Over the coming months I will be posting some details on the various projects I have planed to make the house more energy efficient and retrofitting it for a high tech and gadget lifestyle. Should be fun!&lt;/p&gt;&lt;img src="http://chriskirby.net/aggbug.aspx?PostID=189" width="1" height="1"&gt;</description><category domain="http://chriskirby.net/archive/tags/Hacks/default.aspx">Hacks</category><category domain="http://chriskirby.net/archive/tags/Personal/default.aspx">Personal</category><category domain="http://chriskirby.net/archive/tags/Reviews/default.aspx">Reviews</category></item></channel></rss>