What would Raymond Chen say?

I just read a post from Karl Seguin on CodeBetter (quoting Frans, who quoted Soma) that Visual Studio 2002 and 2003 will not run on Windows Vista. Or to quote Soma directly:

However, we will not support Visual Studio .NET 2002 or Visual Studio .NET 2003 as development environments on Windows Vista. You can continue to use Visual Studio .NET 2002 or 2003 on Windows XP to develop applications that can run on Windows Vista.

And how will they be ensuring that VS 2005 is a great development platform for Vista?

Visual Studio 2005 SP1 will run on Vista but will likely have a few compatibility issues.

Uh huh. So the premier IDE for Microsoft development will work on the Vista with “a few compatibility issues”, while the only good IDEs for developing and maintaining ASP.net 1.1 applications will just not work. At all.

What were they thinking?

It looks like Joel Spolsky’s analysis of the situation within Microsoft has really come true. In How Microsoft Lost the API War, Joel identified two camps within Microsoft: the Raymond Chen camp, committed to maintaining software compatibility between versions of the operating system, even if it meant inserting custom API hacks just to make sure that a poorly-programmed SimCity would still work. Said Raymond:

I could probably write for months solely about bad things apps do and what we had to do to get them to work again (often in spite of themselves). Which is why I get particularly furious when people accuse Microsoft of maliciously breaking applications during OS upgrades. If any application failed to run on Windows 95, I took it as a personal failure. I spent many sleepless nights fixing bugs in third-party programs just so they could keep running on Windows 95.

This attitude towards maintaining program compatibility continued through XP. And we are not talking about Microsoft-developed applications, intended to make Microsoft more money. We are talking about third-party games, VB6 apps, old DOS console apps. You name it.

The other camp is the “MSDN Camp” – eternally committed to releasing (and rereleasing, and patching) the newest and greatest technology, compatibility be damned. And as Joel pointed out, starting with VB 6.0 to VB.net, IIS 5.0 to IIS 6.0, new Microsoft products were no longer fully compatible with old ones.

Which brings us to today. Microsoft has made the decision to completely abandon a program which is still used by a very large number (if not most) of programmers who develop for Microsoft technology. Why?

Given the customer feedback that we’ve received since the launch of Visual Studio 2005 indicating the manageability of upgrading from Visual Studio .NET 2003 to Visual Studio 2005, we are focusing our efforts on ensuring VS 2005 is a great development platform for Vista.

Thanks Soma. But no thanks. The migration from Asp.net 1.1 to 2.0 does not work flawlessly. And even if it did (which is probably never, for many of the very complicated webapps out there coded in 1.1), why should we? Why risk breaking something that is already working? In order to use Visual Studio 2005 on Vista, which will hopefully not have too many “compatibility issues”, and will hopefully be able to handle all of our programming needs (covering any .Net framework, as long as it is 2.0)?

No thanks. Personally, unless something drastic changes, I don’t see myself switching from XP to Vista for some time to come. And I am sure that I will not be alone.

Error when sending Html Mail from ASP.net WebApp

On an ASP.net site (1.1), I was trying to send an email message using good old SmtpMail.Send(MailMessage message). When I did so, I got the following message “could not access CDO.message object“. After some Googling, I tried out all of the different security/smtp/relary/permissions related suggestions (most can be found on the systemwebmail.com site, a very handy reference if you have some questions regarding use of the System.Web.Mail library in ASP.net 1.1). Still not working. I checked the InnerException. It looked something like this:

InnerException: {“Unknown Error” }
Message: “Exception has been thrown by the target of an invocation.”
Source: “mscorlib”
StackTrace:
” at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)\r\n
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)\r\n
at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)\r\n
at System.Web.Mail.LateBoundAccessHelper.SetProp(Object obj, String propName, Object propValue)”

But nothing apparently wrong there. The one weird thing that I could find is that if I set MailMessage.BodyFormat = MailFormat.Html, it would not work. If I set it to MailFormat.Text, it would work fine. Very suspicious.

In the end, the following solution worked for me. It was posted by Kyle Parker on the DotNetNuke forums:

  1. Close Visual Studio
  2. Open a Command Window
  3. regsvr32 cdosys.dll /u
  4. iisreset /restart
  5. regsvr32 cdosys.dll
  6. resume work in VS

After unregistering and reregistering this DLL, suddenly I was able to send Html mail again from my site. Kyle reported on his post that this only worked as a temporary solution. It is working for me so far.

Anyone know why this happened? Some other program messed up the dll that handles Html mail?

Programatic access to the ConnectionStrings section of your Web.Config file in ASP.net 2.0

Back with ASP.net 1.1, if you set a connection string in your Web.config file, you could set it with something like this:

<appSettings>
  <add key="ConnectionStringName" value="ConnectionStringData" />
</appSettings>

and get access to the string in your code with something like this:

string connString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionStringName"];

With ASP.net 2.0, while you can still use appsettings if you so desire, there are now subsections allowed in the Web.config, one of which is set aside for database connection strings. Here is how to use it:

<connectionStrings>
  <add name="ConnectionStringName" connectionString="ConnectionStringDetails"/>
</connectionStrings>

The good news with this is that the connection string within your Web.config file is no longer just some string (that while you may know it is a connection string, your application has no intrinsic knowledge of this). Your website can now access this string in a number of different ways, in general making your life easier (especially when using the Website Configuration screens, or any of the built-in data access controls).

All of this is old news. However, while the process for retrieving a connection string in 2.0 is well-documented when you are doing it from within the setup wizard of a DataAccess control, I had some trouble figuring out how to retrieve it solely within the code. Eventually (with some help from Google) I was able to find the exact syntax, and I am passing it on here so that it might help someone else facing the same problem.

string conn =  System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;

The Server Failed to Load Application

Due to some bad problems with my main machine, I have been in the process of bringing my backup laptop (Inspiron 5150, 768mb RAM, almost three years old, recently reformatted) up to speed for my development needs. This included installing Crystal Advanced Developer 10 (required for one of the ASP.net webapps that I am doing maintenance on).

So I installed it, as I have done on a number of computers in the past. I then went and tried to run browse the webapp in question (using http://localhost/appName) and received an HTTP 500 error (IE7 politely told me that this indicated a server error, and that the website might be under maintenance).

I tried loading a totally different webapp that had nothing to do with Crystal. Same error. Reboot, same error. Not good.

So I looked in the System Event Viewer, and saw a bunch of the following warnings:

The server failed to load application ‘/LM/W3SVC/1/Root/appName’. The error was ‘General access denied error’

OK. What is that supposed to mean? And why was it killing all of my webapps?

After a little bit of Googling, I found a page by Brett Hill in IIS Insider (March 2005), with one of the subsections titled: Resolving the Error: The server failed to load application…

The most likely cause of this problem is that the DTC coordinator service has not started. If it has started, then look in the Event Viewer for a message regarding a failed logon for the IWAM_servername account.

So I went into Services, and the Distributed Transaction Coordinator service was running. I stopped the service and restarted it, and voila, all of my sites would run again. Hopefully this situation will continue after my next reboot. If it does, the above article has some more advice on ways around this.

I have installed this program a number of times already on other machines without experiencing this error. Anyone know what may have caused it.

Items of Interest: 2006.04.03

Technorati Tags: , , , , , , , , , , ,

Custom Paging in ASP.net 2.0

Check out Scott Mitchell’s treatment of the subject on the 4Guys website:

As someone who has had to create a long stored procedure to handle custom paging in ASP.net 1.1 (create temporary table, generate query to load IDs into the table, query the temp table with some variables to pull out the records that you want), I am especially excited about the Row_Number() keyword in SQL Server 2005, and the savings in development time (debugging & headaches) that will come along with its proper use.