Subscribe: The ASPSmith's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
article  aspadvice  aspalliance  aspx  database  net whidbey  net  new  pdc  people  remote scripting  scott  server  time  whidbey 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: The ASPSmith's Blog

The ASPSmith's Blog

Some rants about ASP.NET by Steven Smith


Separating Concerns in ASP.NET MVC

Mon, 22 Sep 2014 20:53:08 GMT

If you're using ASP.NET MVC, chances are you're already a fan of SOLID Principles, Separation of Concerns, and perhaps Domain-Driven Design. If so, you may have run into the conundrum of how to remove references to your infrastructure projects from your application's entry point (for instance, your ASP.NET MVC project), since when following the Dependency Inversion Principle you want your application to depend on interfaces, not details.  Using an IoC container like StructureMap, you can easily configure your solution to achieve this, ensuring that at compile time there will be no way for developers to directly use types from your infrastructure project.  I've laid out the details with sample code in a full article on how to use types from a project without referencing it. Let me know if you find it useful, either in blog comments or on twitter where I'm @ardalis.

Switching Primary Blog Locations to

Fri, 13 Feb 2004 07:12:00 GMT

I'm going to be doing most of my blogging over at from now (well, actually a couple of weeks ago) on.  If you're subscribed to this, you should subscribe to instead/as well.


Update: Updated URLs.  Also, get $5 for signing up for a new PayPal-like service I blogged about here (until end of Feb 06).

Production Database Migration

Sun, 14 Dec 2003 22:14:00 GMT

I thought I'd share my experience with moving a heavily used production database for a live website from one server to another this weekend.  The database in question is used to support, but since it has been around for a long time, and since getting additional databases has not always been easy or free, there are several other sites that rely on this same database.  Additionally, on there are a large number of individual ASP and ASP.NET applications, many of which store their connection string information locally.  I'm still not 100% done tracking down all the apps that need updated, but the important ones are done. Why The Move? The move was required for a few reasons, mainly centered around performance.  The site's old db server was a shared box that was housing several dozen clients for my host, OrcsWeb, and I was using about 90% of the resources of the server, so it was time for me to be politely asked to leave.  Also, my negotiations for hosting for 2004 netted me a dedicated database server, and moving to it would let me take advantage of its serious horsepower. Planning I worked closely with Scott Forsyth of Orcsweb.  Scott is an AspInsider and general IIS and hosting guru.  He also is one of the few people that sleeps as little as I do (though I'm not sure that's by his choice), and he has always been a great aid for me whenever I screw up my sites.  We decided last week that the best time for the move would be late Friday/early Saturday, when traffic to the impacted websites would be minimal.  We pulled some baseline performance benchmarks for the destination server (which was already handling all of the mailing list data for so that we would be able to see how much this new load would impact the server.  In the course of watching how the database performed on the shared server, we were able to observe, by Sql Server login, how many cpu cycles were used in a given time period.  Using this information led us to an idea: since this database is used by half a dozen different websites, including several busy ones, it would be useful to know which ones were responsible for varying amounts of the total load. Logging Performance By Username Since we needed to update connection strings for all of the sites anyway, we decided that instead of using the same connection string everywhere, we would set up logins for each site.  So we created logins like '', '', '', etc.  After testing that Sql Server didn't mind the '.' in the names, we decided this would work. Flipping the Switch Shortly after midnight Saturday morning, Scott took detached the old database, copied the files to the new server, and re-attached them.  This process took about 5 minutes, during which time I was ftp-ing web.config files to the various sites to update their connection string information, and Scott was updating a couple of machine.config entries that held similar info.  When the database came up, it didn't work immediately.  We found that for some reason IIS or ASP.NET's connection pool was holding a connection to the old database but was trying to use the new uid.  Each site needed to have its appdomain restarted.  Another issue was that some sites had been using 'ssmith' as their user id, and some of the objects (tables and stored procedures) they were refencing were owned by ssmith.  Now that they were using a domain name as their username, they couldn't view these objects, so we needed to change the owner of these objects to 'dbo' so that all users could use them.  An old script I have (which David Penton originally provided to me) came in very handy, and allowed us to quickly switch all the important objects over to 'dbo' ownership. Checking each site and making these db changes, as well as generally monitoring things and seeing how well the new server was performing, took us another hour or so.&nb[...]

Evolving Custom Web Controls

Sat, 13 Dec 2003 01:06:00 GMT

Although sometimes you start out knowing you need a custom control, what more often happens is you find that you're using the same functionality in more than one place, so you start packaging it up into a control in order to remove duplication and improve reusability.  This article takes a look at when and how you should do such things by taking a fairly simple piece of ASP.NET functionality and evolving it from some code on a form to a user control to a fully-functional custom web control.

Newsgator Activation

Thu, 11 Dec 2003 05:05:00 GMT

Ok, so I got newsgator last week ( and today was the first day since then that I actually rebooted my machine and got the nag prompt to activate it when I started Outlook.  So, having become enthralled with the product, I decided what the heck and spent the $29 to buy it.  Got my activation key in an email a few minutes later, life was good, I clicked on NewsGator in Outlook and went to find the Activate link.

However, unless I'm blind, there is no Activate link.  Sometimes they'll put it in the About section.  Nope.  Other vendors think it goes under Help.  Nope.  I even went into the Help to see if there was Help on Activating.  Nope.  Ok, fine, I knew it nagged me when Outlook started, so I restarted Outlook.

Voila - nag prompt for the Activation Code.  I click 'Activate' and it asks for the code.  Well, no problem, it's in an email - let me just... oh - the nag prompt is a modal window and I can't touch any emails while it's up.  Nice.  So I have to cancel again.  Find the email again.  Copy the key to Notepad.  And finally restart Outlook again before I can register the product.

Note to the Newsgator people - if you want people to activate the product, make it a little easier to do so via a menu, rather than relying on your interruption-based nag prompts.  Otherwise, though, great product so far.

Newsgator 1.3

Fri, 05 Dec 2003 08:41:00 GMT

I've never used Newsgator before but since I just redid the RSS feed on I thought I should give it a shot and see how it works (I've also only recently gone to Outlook from Outlook Express (see past archives for my thoughts on the switch)).  I have to say I really like it and am starting to subscribe to a bunch of blogs that previously I would manually periodically check with my browser (I know, how archaic is THAT).  So now, that thing on the side of my blog that says 'Blogs I Read' will actually be a bit more accurate, since I'll get notified of new posts to those blogs in semi-realtime.

Sweet. RSS Is Back

Fri, 05 Dec 2003 08:38:00 GMT

After a couple of months of downtime,'s RSS Feed has returned and is better than ever.  Thanks to Scott Mitchell for his cool MSDN article on building an RSS feed.


PDC Sessions

Sun, 23 Nov 2003 08:10:00 GMT

In addition to the powerpoints available at you can also watch the presentations, including demos, in MS Producer format at have noted this - I mention it here so I can find the link later... :)

SYS-CON Radio Interview (PDC 2003)

Mon, 17 Nov 2003 06:31:00 GMT

My SYS-CON Radio Interview from PDC has recently been published on their website (along with a great many other more important people's interviews).  Check them out and download them in MP3 format.

Speaking At Memphis DNUG

Sat, 15 Nov 2003 06:39:00 GMT

I'll be speaking at the Memphis .NET User Group on Tuesday, 11/18.  I'm going to be giving an overview of ASP.NET Whidbey, which of course has recently been made public at the Microsoft Professional Developers' Conference 2003 in late October.  For more information and directions to the event, see the MNUG website.

Regex To The Rescue For Shorter URLs

Thu, 06 Nov 2003 18:06:00 GMT

I've been redesigning off and on for the last several months, and I made a few more changes this morning.  The big one that is noticeable to the general public is the URLs.  Instead of having to link to articles via a viewer ASPX page and a series of querystring values, it is now sufficient to simply append the article ID to the end of the domain name (after a slash), like so:  (article ID 1, which is my Excel Reports in ASP article).

The nice thing about this is that it uses Context.RewritePath, so there is no Response.Redirect and the user never sees the actual URL of the page handling the request.  The regex I'm using is here:

The actual code looks like this:

string originalUrl = Request.Url.ToString();
// Check for article shortcuts (e.g. )
string newUrl = AspAlliance.Web.Core.HttpRedirect.GetRedirect(originalUrl);
if(newUrl != originalUrl)
System.Uri myUri =
new System.Uri(newUrl);

// GetRedirect:

System.Text.RegularExpressions.Regex regex =
new System.Text.RegularExpressions.Regex(@"\.com/(\d+)$",
(System.Text.RegularExpressions.RegexOptions.Compiled |
System.Text.RegularExpressions.MatchCollection matches = regex.Matches(badRequest);
if(matches.Count > 0)
  string id = matches[0].Value.Replace(".com/", "");
  int aId;
    aId = Int32.Parse(id);
    return "" + id;
return badRequest;


Touchgraph GoogleBrowser

Fri, 31 Oct 2003 01:50:00 GMT

Check out this cool tool to map out where your website is in the Internet space, according to Google.

TouchGraph GoogleBrowser

PDC 2003: Caching Birds of a Feather : Summary of Tips

Thu, 30 Oct 2003 22:23:00 GMT

I hosted a Birds of a Feather Tuesday night at PDC 2003 and we had about 25 or 30 people attend, including Rob Howard of the ASP.NET team (responsible for the caching featureset).  I've published a summary of the tips along with some resource links we discussed at the meeting on

Caching Tips from PDC 2003

PDC ASP.NET Panel Discussion - Non-Postback Callbacks to Pages

Thu, 30 Oct 2003 21:46:00 GMT

A new feature in Whidbey will allow controls to make calls directly back to page methods without making full postbacks.  This features uses XMLHTTP behind the scenes and allows controls to talk to the server in an optimized fashion without requiring a full postback.  In the 1.x timeframe, a solution for this which you can use today (and which actually may be simpler to implement based on what I've seen), is remote scripting.  Remote scripting was available in ASP 3.x but wasn't widely known to most ASP developers.  Jonathan Cogley of AspAlliance has written up a toolkit that makes implementing cross-browser remote scripting (non-postback callbacks to the server) very easy to implement in ASP.NET, including 1.x.

Cross Browser Remote Scripting Client

ASP.NET Remote Scripting

ASP.NET Whidbey Discussion Lists Launched

Wed, 29 Oct 2003 15:38:00 GMT now has about a dozen lists set up for the discussion of ASP.NET Whidbey.  If you've got the PDC bits, this is a great place to look for help if you get stuck with something.  Many of the members of these lists will be folks who have had access to the bits for some time and of course Microsoft employees themselves.  You'll find the full list of signups here:

AspAdvice Whidbey Lists (

Tuesday at PDC

Tue, 28 Oct 2003 23:38:00 GMT

Managed to get to some sessions today, including the morning's keynote, which was lucky since I was out pretty late with a bunch of Codewise community members and Microsofties.  The keynote was pretty cool, and included an excellent demo by Scott Guthrie as well as a fun demo of mobile control support by Batman.  I spent most of the middle of the day in the expo hall talking to various vendors about what they're doing in the .NET space and how ASPAlliance and AspAdvice can help them reach the developer community.

Right now, I'm sitting in Rob Howard's advanced caching session, where he's going through the new caching features that will be available in ASP.NET Whidbey.  You can find an overview of these features on, in an article I whipped together during the session:

ASP.NET Whidbey Caching Overview

PDC2003: 1623 on Day One

Mon, 27 Oct 2003 23:26:00 GMT

Ok, this post will be of little use to most people - I apologize.

I got in at 10am or so, one of the few people unaffected by the airport delays caused by all the fires.  Managed to get checked in at hotel and to the convention center by noon, just in time for lunch.  Met Scott Swanson and Serge from VbCity for lunch, then hit the expo hall for a while.  Talked to a bunch of vendors, saw Andrew Duthie, the Junkies, Rob Howard.  Alex Lowe's stuck in Chicago as of 2pm and Neil Rowe from SAMS is stuck in Denver.  Spent some time talking to Erik Sink of SourceGear Vault.

Anyway, the expo hall closed around 4pm and I headed back to my hotel to meet with Codewise Community people at 4:30.  So, with 5 minutes to spare, I'm shooting off this email.  I'll post pictures and maybe add some links to this post later.

SourceGear Vault Review Published

Mon, 27 Oct 2003 05:10:00 GMT

I've been using SourceGear Vault for a while now and have been pretty happy with the product.  I've published a review on

Review: SourceGear Vault

Hope LAX Is Open For me...

Mon, 27 Oct 2003 05:04:00 GMT

Well, I'm leaving Ohio in about 4.5 hours for Atlanta, then getting into LAX (in theory) at 10am local time.  Hopefully the airport won't be burned down or closed or anything.  See everyone in PDC if I make it there.

34 Hours to Departure for PDC 2003

Sat, 25 Oct 2003 23:38:00 GMT

My flight leaves at 0535 Monday morning from Akron-Canton, getting me into Los Angeles at 0951.  I figure I'll probably make it to the hotel by 11am and the convention center by noon, which means I'll miss the keynotes.  :(

I'm looking forward to meeting a ton of folks at PDC this year.  I think I've got more meetings set up than sessions to attend, so I guess I'd better order the DVD with the slides.  I can't wait to be able to write some articles about Whidbey on  I got the latest issue of aspNetPRO, in which I wrote an article for this month's issue (being released at PDC and devoted to Whidbey), and there is a lot of great content in it (Paul Wilson, G. Andrew Duthie, Stephen Walther also contribute, and there is an interview with Scott Guthrie that should definitely not be missed.)  So anyway, reading that has me itching to publish some v2 stuff on, so look for some good stuff next week.

Stop by Wednesday in the exhibit hall from 2pm-2:45pm.  Rob Howard and I will be signing copies of our book, the ASP.NET Developer's Cookbook.  You can sign up for the 2.0 cookbook, which will be full of all-new recipes for Whidbey, and receive a discount when it's published.

I also got an 'I'm Blogging This' T-Shirt for PDC which reminds me quite a bit of the McDonald's 'I'm Lovin' It' campaign that they're running now.  I'll be sure to wear the shirt at least one day this week.

I'm in town until Thursday night - my flight is at 2255 (10:55pm), which gets me home at 0950 Friday.  Humorously, I have an appointment Friday morning at 1030 that I'm supposed to be awake for - we'll see how that goes.