Archive for the ‘ASP.NET’ Category

Quick and Dirty View of ViewState

Wednesday, February 13th, 2008

At the place of my employment, the pace of development is very fast. Fortunately ASP.NET is terrific at doing rapid development. Unfortunately, it’s also very good at helping you make bad mistakes if you are not careful. ViewState is one of those great technologies that makes whipping up a website quick, but will bite you bad if you forget to keep track of it. That happened to me on a recent page where the number of controls is quite staggering. The problem is not the number of controls, but the amount of ViewState that gets created to support them. I needed to reduce the amount of content in ViewState fast!

(more…)

Open Source .NET?

Tuesday, October 23rd, 2007

I just read that Microsoft intents to release most of the .NET Framework as open source. The complete text of the article can be found at the link below. This would be fantastic! It would also make my .NET debugger project Clutch almost worthless. One of the big goals I had for Clutch was to be able to debug IL, or at least a decompiled representation of IL. The intention was to allow debugging of not only personal code but also the ability to drill right into the base class libraries and windows forms code. Microsoft’s announcement makes it sound like they’ll also be shipping .PDB files with debugging information and symbols. While this is great news, it also means that I’m officially shelving my Clutch project for the time being.

Resources:

Update [11/5/2007]: As it was pointed out to me, Microsoft will not be looking for community contributions and so the term “open source” is a bit misleading. At this point they only intend to make the source code available for viewing and debugging purposes and all future development will still be handled by Microsoft.

Multiple File Upload

Thursday, September 13th, 2007

I’ve always found it unpleasant when I have a number of files to upload and the website I’m at only allows one file upload at a time. If you have multiple files to process it can seem like an eternity. Just ask my wife when she’s uploading all those family photos to her blog.

One possible solution is to place several file input controls on the page (say five) thereby reducing the number of roundtrips to the server, but that is still an artificial limit. What I wanted was a control that would dynamically allow any number of files to be uploaded all in one shot. Something that would increase usability and not take away from it.

Here’s what I came up with:

Multiple File Upload

(more…)

Debugging JavaScript with Visual Studio

Wednesday, August 1st, 2007

I recently had a situation at work where I had to do some deep debugging of JavaScript. As an ASP.NET developer, I rarely have to hand-write JavaScript now days and when I do it requires little more than some well-placed ‘alert’ calls to diagnose problems. However, this situation was different. We recently started using the ASP.NET AJAX Extensions in our company website. Initially I was excited to try some of the new features but alas my excitement quickly waned when I found that many of the supplied controls did not play well with our website. I should be clear that I’m referring specifically to the ASP.NET AJAX Control Toolkit, a community created set of control extenders that use the AJAX library. I’m only speaking from my own experience, but it quickly became apparent to me that the ASP.NET AJAX Control Toolkit was only half-baked. I had popup controls popping up in the wrong places, watermark controls returning their watermark contents instead of their actual values, and the list goes on. By the time I realized it, it was too late and we had already promised some of the advanced features to our clients. My task today was to figure out why the CollapsiblePanel was no longer working after we moved our code into our test environment. I was going to have to debug some JavaScript… ugg!

(more…)

Elegant way to get appSettings

Wednesday, May 9th, 2007

With the rollout of VS2005 and .NET 2.0 we got a couple new options for getting values out of config files. The most prominent of these is the strongly-typed Settings class generated when you use the VS2005 Settings designer. However, this option is not always available if you have lots of legacy code that uses keys/values in the appSettings section of the config or you’re using a .NET 2.0 Web Site which doesn’t support the VS2005 Settings designer out-of-the box. BTW, how did Microsoft overlook that?

As an ASP.NET developer I’ve seen many different approaches to getting appSettings out of the config file and have yet to find a better technique than this static method:

(more…)