ASP.Net MVC Release Canidate

If you didn’t know already, ASP.Net MVC framework is int he release candidate stages. Wahoo!!!. As per usual ScottGu over at Microsoft posted insanely detailed remarks on the new features. Check it out here.. Some notable improvements that I have used and like thus far include NO MORE CODE BEHIND FILES (this is my favorite), shortcut’s to switch between views and controllers, and “scaffold” like generation of views and controllers using the T4 template engine in Visual Studio.

jMonthCalendar: Patch Relese 1.0.1

I just released my jMonthCalendar (the full month event calendar) with some new enhancements/fixes upon request. The change log can be found here along with updated samples and direct download. Fixes include: month name display in IE, isArray function not present in older version of jQuery, and new configurable first-day-of-week that the calendar starts on (Sun, Mon, Tue, etc).

My Recent Positive Experience with Apple

So recently (the past year) I had an issue with my MacBook Pro and it’s battery life.  My laptop is was bought in February of 2007 so of course the manufactures warranty expired on February of 2008.  This was concerning cause some time after the warranty expired my battery life went to heck.  I could not work with having to stay connected to the wall.  If I did try and roam the house or go to a coffee shop to meet with a friend my laptop would last 30 minutes before self powering down.  This sucks, I have a laptop in order to be mobile and away from the and AC outlet but am limited to 30 minutes of work, this doesn’t boad well for me.  As 2008 went on 30 minutes of battery power went down to 20, then 10, then there were a few times that would only last 5 minutes if the computer was doing anything intensive.

As of today my warranty has been expired for almost a year.  I didn’t think anything of it and thought I would have to break down and buy a new battery.  Since I got used to having to be near an AC outlet I thought nothing of it.  It wasn’t until I had done some research on apple MacBook Pro batteries only to find out that there were issues with the batteries and that there were many case of Apple replacing them (even out of warranty) free of charge.  So I mad an appointment last night at the genius bar.  The genius was very nice and pointed out my laptop was out of warranty and that it shouldn’t be covered BUT…  The details of a bad battery were evident.  I had 1016 Mah of power at full charge with 250 full power cycles.  Normally the battery should be reporting 80% of the battery capacity at 300 cycles.  The normal full charge is about 5000 Mah.

To end the long drawn out story… Apple saved my but and “it was in the best interest of them to replace the battery free of charge”.  I walked out of the store with a brand new MacBook Pro battery installed, and I didn’t have to pay a peny.  Apple, you are the best.  You know how to take care of your loyal customers.  I could almost guarantee that if it were any other company they would have told me to get last or presented with a $100+ bill.

So this goes out to anyone who might be in the same boat, all you have to do is ask.  What is the worst Apple is going to say “No”?

ASP.Net MVC “Areas/Modules”

In this post Phil Haack explains how Areas can be accomplished in the ASP.Net MVC framework.

I really like this idea of have Areas or Modules in ASP.Net MVC.  I have been in the process of developing a Forum for a website and came across this after I was complete.  I thought that “yes it would be nice to use this same logic in another application”, and having an areas or module to move around would be quite nice.
Continue reading

ASP.Net MVC Route Table Ordering

Over the past few weeks I have been working on an MVC forum component for a website I maintain/develop (http://pertnearsandstone.com).  As I was working through the various screens I would set up the intended routes to the route table in my global.ascx.cs file only to learn that route ordering is very important. The order of the routes affects the flow and logic of your application.
Continue reading

Frustrating IIS7 Configuration 500 Error

Recently I have been putting a lot of my evenings and weekends in to a re-architecting of a site I host and develop for some friends of mine Pert’ Near Sandstone. The Entire site is built using ASP.Net and features a standard (web forms) website front end (public facing) and an admin side also built using web forms.  I liked this at the time, but it soon became very difficult to debug, maintain and add features to.

The biggest factor in deciding the re-architect the site at the time was the lack of interoperability in the Admin side/application.  It worked as intended about 60% of the time (60% of the time it works every time).  The web forms admin side required a lot of code that was spread out over numerous code behind files, making it difficult to maintain.  Not to mention similar logic was being duplicated, violating the DRY principal (don’t repeat yourself).

Around the same time I had just finished my exploration of the new ASP.Net MVC (model-view-controller) model and had fallen in love with web development all over again.  I had been in the process of creating some sample applications with it.  I even started testing how it deployed on various web hosting platforms.  I discovered that the MVC pattern DID work on IIS6 and IIS7.  The URL’s on IIS6 required special mapping (either adding .aspx or .mvc to map to the aspnet framework), I didn’t like that so I found a host that offered IIS7.  The URL’s are now clean and to my liking.  MVC makes sense, it creates clean separation of UI, business logic and data models. and will be an architecture of choice on ASP.Net.

So to make my long story short and to the point.  I ended up re-architecting the Admin (once web forms side) of my site/project into a new MVC project in my solution.  I started bringing over functionality one peice at a time, while reworking the underlying business logic and data access logic into various providers and repositories.  I had everything working perfectly for a phase one deployment to the web host.  I had 2 projects to deploy, one public facing site (web forms) and one admin MVC site.  I set up the web host to use a virtual directory for the the MVC site, configured my connection strings as:

    <connectionStrings>
    <!-- PRD -->
    <add name="PertNear.Data.Properties.Settings.PertNearSandstoneConnectionString"
connectionString="server=secureserver.net;uid=user;pwd=pass;database=db"
providerName="System.Data.SqlClient"/>
    <add name="PertNear.Membership"
connectionString="server=secureserver.net;uid=user;pwd=pass;database=db"
providerName="System.Data.SqlClient" />
 
    <!--
    <!--  DEV
    <add name="PertNear.Data.Properties.Settings.PertNearSandstoneConnectionString"
connectionString="Data Source=localhost;Initial Catalog=DB;Integrated Security=True"
providerName="System.Data.SqlClient" />
    <add name="PertNear.Membership"
connectionString="Data Source=localhost;Initial Catalog=DB;Integrated Security=True"
providerName="System.Data.SqlClient" />
    -->
    </connectionStrings>

I uploaded everything to the virtual directory and tried to access the new applications. The public facing side (web forms) worked cause it had a separate config file, the admin side through the generic IIS7 internal server error with no messages. I looked everywhere to find a solution. Many sources said to add a wrapping element around the parent web.config so that it’s settings don’t conflict with the virtual directories (inheritance in IIS7 config files). I spent a week plus on this issue until I ran the config file through an XML validator. As you can see I had a rouge comment tag in the config. Had I known that IIS7 was first validating my config file I might have gotten an error along the lines of “invalid xml” instead of generic 500 error.

Reader be warned, be sure the validate the web.config file before uploading. And check the config file before you make any drastic changes like I did (I moved the MVC project into the public facing site to now have just one project to deploy, thinking that might solve the issue). One point worth mentioning, I had edited my published web.config outside of VS2008 in a text editor, hopefully VS would have caught that error for me had I known.

Good luck, happy coding and avoid the frustration I had.