September, 2012 browsing by month


Do not use VS2005 to edit .Net 1.1 aspx file

Friday, September 28th, 2012

Today, I learned another painful lesson using Visual Studio 2005 to edit a live ASP.Net 1.1 page (.aspx file) – after I made some minor change on html codes and saved it back , the whole site blew up. What happened was that VS2005 automatically inserted a few .net 2.0 assemblies into the web.config file on the live server, even I just pull down a file to local machine and used my VS2005 to edit it.

These are those assemblies that were added by VS2005:

<add assembly=”System.Web, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>
<add assembly=”System.Configuration, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System.Drawing, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System.Xml, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>

Previously I used either VS2003, notepad or VS2008/2010 to edit the same page and never encountered something like this. So this must be some VS2005 specific bug and Microsoft probably realized that it did too much automation in VS2005 and fixed that in later versions of VS.

So never edit a .net 1.1 ASP.Net webpage inside VS2005.  It is fine to use VS2003, VS2008 or VS2010, though.

One glitch to watch for while migrating jQuery lib from 1.3.2 to 1.7.1

Friday, September 14th, 2012

A recent deployment of my production website involved upgrading jquery library from jquery-1.3.2.min.js to jquery-1.7.1.min.js. Everything seemed to be fine except one place that was out of place – a customized div message box that initially displayed correctly next to mouse pointer now moved to the upper left corner of the screen.

What happened was that somehow 1.7.1 no longer supports $().mousemove() without passing in a definitive element identifier in the $(). Before the upgrade (jquery1.3.2.min.js), I used this code to capture the mouse position:

 var mouseX; var mouseY; $().mousemove(function(e){ mouseX=e.pageX; mouseY=e.pageY; }); 

And the mouseX and mouseY would have legit values. But these values were lost when I upgraded to jquery.1.7.1.min.js, if I kept the same code.

As it turned out, I needed to put a definitive html element id, either an id for a div or a table, in the $(). The new code that works the same as before the upgrade now should look like this:

var mouseX;
var mouseY;


Now my popup box would display correctly to where I have my mouse over some item with this code below:

function showHints(msgDivId, msg,visible)
//alert("mouse position: " + mouseX + "," + mouseY);
var ch=$("#" + msgDivId);
if (visible && msg.length>0);