2006
171 articles published in 2006
-
Use FxCop with ASP.NET 2.0
The build process in ASP.NET 2.0 is very different than in ASP.NET 1.x, because it does not produce a dll file. That means that you cannot use FxCop because it can only work with dll and exe file types. However, there is...
-
Remove nulls from a DataTable
The individual cells in a DataTable can have a null value in the form of System.DbNull.Value. If the DataTable is created by querying a database through ADO.NET, you can write the SQL statement in a way eliminates nulls...
-
List time zones in ASP.NET
If you need a list of time zones for your user to pick from, you probably want a dropdown list. Then you just need a list of time zones to bind to the dropdown list. Unfortunately, the System.TimeZone class doesn’t...
-
Maintain scroll position after postbacks
To maintain the scroll position after postbacks is important for larger web pages in order to let the user know exactly what is going on. It is good usability and something you would expect in modern web applications. In...
-
Let Windows place your temp files
Whenever you need to write files to a temporary location, you can take advantage of Window’s own temporary file store location. It has write permissions by default, which often is a problem for especially hosted websites...
-
A simple factory using Generics
For about a week ago one of my readers asked me to simplify a piece of his code. The code was translating the different tags used by blog comments, such as [url][/url], [img][/img] etc. as we know from WordPress. It was...
-
Get the HTTP status code from a URL
Yesterday, I wrote about the Ping class for checking network availability on remote machines. Then I started thinking about checking the availability of web servers. Even if a remote server is available over the network...
-
Using the Ping class
The Ping class is new to .NET 2.0 and it let’s you ping remote addresses much the same way as the ping.exe command line tool does. It’s a great way to check the availability of different kinds of remote servers over the...
-
Asynchronous pages in ASP.NET 2.0
In ASP.NET 2.0 it is now possible to create asynchronous pages in a very simple and easy way. It gives you a whole new abstraction layer on top of the managed thread pool that let’s any webpage take advantage of...
-
Remove HTML comments at runtime
I’ve been playing a bit with regular expressions lately and have to find some useful tasks in order to practice the skill. So, today I wanted to make a little method that strips HTML comments from an ASP.NET webpage at...
-
Compression and performance - GZip vs. Deflate
After I wrote about a HTTP compression module in ASP.NET 2.0 one of my colleagues pointed out that the Deflate compression is faster than GZip. Because the HTTP compression module chooses GZip over Deflate if the browser...
-
Why App_Code is better
I remember when ASP.NET 2.0 beta 1 was released about 2 years ago and I eagerly tried it out. The first thing that struck me as strange was the new application folders like App_Code, App_Data, and App_Themes etc. They...
-
Refactor the code before you write it
Have you ever heard the saying “If you don’t know where to look, don’t look at all”? Think about this saying and coding. If a piece of code somewhere in the system is causing an error, don’t split the whole thing apart...
-
An HttpModule that moves ViewState to the bottom
There are two reasons why it is desirable to do so. The first is for letting search engines see more of your content rather than the big portion of ViewState many sites have. The other is perceived rendering time, which...
-
Brute force protect your website
On a website with the ability for users to logon, it is a good idea to have some sort of password policy. The most widely used contains minimum requirements for the length of the password and that the individual...
-
Combine accessors in C#
Today I had to add some functionality to an already existing class library. In there were a internal virtual method that I thought were supposed to be protected virtual. To no big surprise, I couldn’t compile after...
-
Using the W3C HTML Validator API
The W3C has introduced an API for their HTML Validator. It is not a SOAP web service, but it does return XML that can be parsed, so now you have the ability to incorporate validation to any web application, Windows...
-
Add multiple classes to HTML elements
I recently realized that you can add more than one class to a single HTML element. This opens up to even more structured stylesheets and more code reuse. It’s a standard and has cross-browser support. You simply just...
-
Is ASP.NET too difficult?
There is no doubt in my mind, that ASP.NET is the most powerful and versatile platform for web applications at the moment. By leveraging the .NET Framework you can do absolutely anything in no time, but is that power...
-
Pull a prank on your co-workers
Office pranks are among the funniest and we’ve probably all done some of our own over the years. This time, my boss and I came up with a good one. Write an add-in for Windows Live Messenger that auto replies to all...
-
Remove unused objects from the session
The Session in ASP.NET is a very simple way of storing user specific data for the duration of a single user session. I’ve many times added data to the Session that had an even shorter lifespan. That could be as a data...
-
Tip for localized websites and the html tag
For a website that supports multiple languages, it is important to tell the client what the selected language is. This is done in the <html> tag in the lang or xml:lang attribute and could look something like this for an...
-
Replacement for invisible columns in the GridView
For security reasons Microsoft doesn’t allow invisible columns in a GridView to be posted back like it does in the old DataGrid. That makes it impossible to store the ID of the row in an invisible column and then use it...
-
Event handling with anonymous methods in C# 2.0
One of the nicest things about the new anonymous methods is how simple event handling has become. Here is an example of how we used to handle events. It demonstrates how to add an event handler to the btnSave’s Click...
-
A realtime currency exchange class in C#
Soon, I’m facing a new project where the need for up-to-date currency exchanges is crucial. This is not the first time I’ve done this, but I wanted to make a reusable, self-maintainable class so I don’t have to do it...
-
Looking at The World as an outsider
Lately, I’ve felt a bit alone in The World of what’s new, cool and wonderful. If you’ve been following the Web 2.0 blogs lately, you know what I’m talking about. I feel like everybody is talking a language I don’t...
-
Permanent redirection in ASP.NET
The easiest way to make a redirection in ASP.NET is using Response.Redirect(url). What it actually does is, that it creates a response with the “302 (Object Moved)” status code and the target destination. It tells the...
-
Simple method to avoid comment spam
We probably all know about the annoying captcha images that a lot of blogs uses for separating humans from machines (spam robots). I use a captcha image to avoid comment spam on this blog because I get a lot, but I...
-
Toggle visibility of non-server controls from code-behind
Since ASP.NET 1.0 you had the ability to toggle the visibility of any HTML tag with the runat=”server” attribute. The only prerequisite is to add the runat=”server” and ID attributes, but that is not always possible or...
-
Boost performance using the CompilationMode attribute
ASP.NET 2.0 introduced the CompilationMode attribute to let the developers decide how to compile individual pages, user controls and master pages. You can set the value to these three values: Always Auto Never This is...
-
Add social bookmarks to dasBlog
As you can see at the bottom of each blog post, I’ve added social bookmark links. Because I use dasBlog version 1.8 it was very difficult to do, mainly because there is no macro to print out the title in clear text of...
-
Submit disabled controls in ASP.NET 2.0
I recently built a JavaScript function in HeadLight that filled a textbox from JavaScript and then disabled the textbox to prevent the user to alter its contents. When the form was submitted, it didn’t submit the...
-
Control the number of alternate rows in the GridView
The GridView control (as well as the DataGrid) has a way of defining the style of every other row of the grid. My favorite way of doing it, is to set a class on the row and then by stylesheet set the background like so...
-
Spam proof your website using an HttpModule
Every time an email address is written on a website, it allows spam robots to collect it and abuse it. If you have a website (e.g. blog or forum) that displays the users e-mail address it would be a nice service to mask...
-
Speed up web services using the SoapDocumentMethod attribute
I’ve done a lot of web services during the last couple of years and I simply love Service Oriented Architecture using SOAP. The power of using services as a means to create large connected systems are enormous but...
-
A better string control in ASP.NET
Whenever I had to add a string to a web controls control collection I’ve always used the Literal control like this: Literal str = new Literal (); str.Text = "hello world" ; Page.Controls.Add(str); I have always thought a...
-
Validate a URL using regular expressions
Today, I had to build web form that took user input from standard ASP.NET input controls. In one of the text boxes the user must to enter a valid URL, so I had to make some validation logic. But first of all, I had to...
-
Where is .NET?
The developer community has gotten big on the Internet the last couple of years – very big. New blogs are constantly adding value to the blogosphere which seem to grow by the second . There is no doubt in my mind that...
-
Export a DataTable to Excel in ASP.NET
Back in February I wrote a post on how to export DataTables to XML and Excel and I still get a lot of search engine traffic to that post. People have been asking me to simplify the example and only concentrate on the...
-
Server-side and client-side caching in ASP.NET
Caching is a very easy solution to many performance related issues on almost any website. There are many different ways to use server-side caching and they all have their own unique advantages. But client-side caching is...
-
IE 7 final release is here. Come get it
IE 7 final will be released very soon, but already now you can download it. The final version number is 7.0.5730.11. It doesn’t appear to be much different from the last beta. I've just downloaded it and the installation...
-
Set HTML header items programmatically in ASP.NET 2.0
Among the differences between version 1.1 and 2.0 of .NET Framework is the many new controls. Even though most of them don’t add new functionality they make a lot of things much easier and cleaner than before. Some of...
-
Traditional developers vs. web developers vs. CSS
In the year of 2006 it can be hard to avoid doing web development to some extend no matter what kind of developer you are. The lines between the traditional windows applications and the more web based ones have become...
-
Examine animated Gif’s in C#
Recently at work, we had to find a way to examine Gif images to find out if they were animated or not. It’s a good thing to know when dealing with banner advertising. The solution was to create a method that would return...
-
Download album art for free through a web service
I recently played with building a C# media player with built-in music library and wanted it to show album covers like Windows Media Player 11 does. It proved quite difficult because there is no free service for downloads...
-
It’s good to be a control freak
Custom web controls for your ASP.NET application are a brilliant way to separate, reuse and “refactor” your code pieces. In that sense I consider myself to be a control freak and that's a good thing! In our product...
-
Long hours and crappy posts
I regret to tell you, that this is the best I could come up with today. No code samples or anything interesting or any kind at all. The reason is that we had to meet an important deadline at work today and that kept me...
-
Add variables to standard CSS stylesheets in ASP.NET
After reading a post on The Cafes about the lack of dynamics in the CSS language, I found myself inspired to do something about it. It became clear that something had to be done and that we couldn’t wait for the W3C to...
-
Solution to the Firefox port problem
The built in webserver in Visual Studio 2005, formerly known as Casini, uses a dynamic or static port on the localhost machine (e.g. http://localhost:2049/default.aspx). It is dynamic by default, but you can make it...
-
Add a MicroSummary to any ASP.NET page
Scott Hanselman showed us how to add MicroSummaries to a website using an .ashx file. It was clean and simple, but it would be really cool if we could use the description meta tag instead so we don’t have to maintain two...
-
A whitespace removal HTTP module for ASP.NET 2.0
I’ve written about whitespace removal before , but I think this is the best solution so far. It is a plug n’ play HTTP module that works simply by adding the class to the App_Code folder. It uses regular expressions to...
-
Add social bookmark links to any ASP.NET page
Social bookmarking is often thought of as being something used only on blogs. That’s probably because you only see them on blogs, when they in fact could be used at most other types of websites as well. It is a feature...
-
XML membership provider for ASP.NET 2.0
ASP.NET ships with a SqlMembershipProvider and a ActiveDirectoryMembershipProvider that makes user authentication and authorization very easy to implement, but for some reason those are the only membership providers...
-
Little Helper – a true Web 2.0 application
Little Helper , the interactive help system for Headlight is now live and almost finished. It is build much like a Wiki so Headlight users can contribute and ask questions. I like to call it a good mix of a blog and an...
-
Wildcard search for domains in C#
At work, we had to do wildcard searches using regular expressions to match allowed domain names. For instance, this expression “*.madskristensen.dk” should match “www.madskristensen.dk”. So, my boss Jimmi wrote a method...
-
Convert a date to the RFC822 standard for use in RSS feeds
Today I wrote a new dynamic RSS feed for a little project called Little Helper . It all works fine, but when I tried to validate it using FeedValidator , the pubDate was invalid. The validator told me that the date was...
-
Firefox and IE read file names differently
In a recent web project I suddenly got an unexpected exception when I was uploading a file using a standard <asp:FileUpload /> control in ASP.NET 2.0. I’ve only been testing the website in Firefox at that point and...
-
Retrieve the subdomain from a URL in C#
Yesterday I had to come up with a method that retrieved the subdomain from the current web request on an ASP.NET website. I thought that the System.Uri class contained that information in an easy retrievable way, but no...
-
Find the number of string occurrences in another string
In C# 2.0 Microsoft introduces some new methods on the String class, one of them being Contains. The Contains method checks if a string in contained within another string in a case-sensitive way. It is very easy to use...
-
Keep security as simple as possible
When building a new application, be it Windows Form or ASP.NET, security is an important factor to consider from the very beginning. There are hundreds of books and thousands of websites helping you to secure your...
-
Validate strong passwords in C# and ASP.NET
It’s always a good idea to have a password policy when creating new applications. A password policy can vary from project to project, but the important part is just to have one to begin with. It is very difficult to...
-
Clean up your music library and other folders
I have a normal sized MP3 collection on my computer and I let Windows Media Player take care of arranging the MP3 and WMA files in the folders based on the media information in the ID3 tags. In my music folder, there is...
-
Update: Stronger password encryption
Yesterday, I wrote how to encrypt a password using a one-way MD5 hash , but as some of the comments point out, the MD5 algorithm is not strong enough. I listened and wrote a new encryption method that uses SHA256 instead...
-
Simple and efficient password encryption in .NET
Four years ago, I was working as a developer in a company that made custom content management systems. We offered back-ups of the databases to our customers on a monthly basis, but in those databases we stored all the...
-
Read file and directory attributes
I’ve just finished a small application that does some IO work on files and directories. The application moves directories to new locations, but every time a folder or file was marked read-only it would of course throw an...
-
Add the correct currency symbol in .NET
You cannot always rely on the browser language as a valid indicator for what currency your visitors use, and sometimes it doesn’t matter because your web application let’s them decide the currency themselves. You then...
-
Get flying with Isolated Storage in C#
Isolated Storage is a place on the disk where your .NET application always has write permissions. That makes it ideal for applications that need to store information such as settings or XML without first asking for...
-
Add your blog to IE7’s search providers
Internet Explorer 7 comes with build in web search from the toolbar, just like Firefox have had for years now. The cool thing about it is that you can offer your visitors to add your blog search to the different...
-
Performance optimization of an if/else-statement
Have you ever considered how well a regular if/else-statement performs? I haven’t, but after watching this Channel9 video I wanted to test it. In the video, Brian Beckman explains that the order of the statements is...
-
Add Windows Live Alerts to your blog
Some of my readers have been asking me how I’ve added the Windows Live Alerts functionality to this blog. I simply love this feature and I hope that it will spread to some of the blogs I read daily. It allows me to get...
-
A smart base class for business objects
As you may know by now, I’m a big fan of Rockford Lhotka’s CSLA.NET framework and base classes. It’s packed with all sorts of cool functionality and I’ve used it for several years in various projects, but often I’ve...
-
Add validation to business objects
Recently, I had to implement validation on business objects in an already existing project. The validation should ensure that the different classes in the business object tier would validate them selves based on business...
-
Overload operators the right way in C#
It’s a good rule of thumb to overload the equality operators on classes. That ensures a correct comparison between to class instances of the same type. If you don’t, .NET automatically uses reflection and that is way...
-
Cross browser client caching
Internet Explorer and the Gecko based browsers (Firefox, Netscape and Mozilla) have different ways of managing their internal cache. The speed of the browser cache is much faster that a server caching, so be sure to do...
-
HTTP compression in ASP.NET 2.0
The new System.IO.Compression namespace in .NET 2.0 makes it easy to implement HTTP compression without having to touch IIS. The best thing about it is that you no longer need any third party compression components, it’s...
-
Create safe events in C#
Whenever you write class libraries, custom control or just about anything else, you probably raise a lot of home made events. That’s a simple thing to do, but tedious to write over and over again. That’s why I always use...
-
Reduce the weight of stylesheets by 35% at runtime
It is always desirable to produce the smallest amount of client-code at any given time. That includes HTML, JavaScript and CSS files. The more client-code you produce, the longer it takes to download and render the web...
-
Securing ViewState efficiently and simple
Even though ViewState is unreadable by the human eye, it is nothing but a base64 encoded string that easily decodes by a piece of software like this one . With this knowledge in mind, you might want to look at how you...
-
The DataRow’s object model has a quirk
I’m sure you’ve used a DataRow a thousand times before without noticing the quirk. I’m not talking about a bug or missing functionality. No, I’m talking about something much less important, but still very puzzling. A...
-
Add true confirmation to the ASP.NET Button control
The JavaScript confirm() function is simple to implement on a Button control, but you can only use it for one particular purpose and that is to confirm a postback. Let’s look at an example of this simplicity first and...
-
JavaScript: Alert.Show(”message”) from ASP.NET code-behind
In highly interactive websites and intranet sites, you probably want to let the users know what’s going on when they delete, save, export etc. on the site. Those kinds of status messages are widely used and are often...
-
Fix the ”Click to activate” Flash content in IE
In the good name of internet security, Microsoft added a feature in Internet Explorer that disables automatic activation of objects. All objects in an HTML <object> tag is affected and that includes Java applets and...
-
ASP.NET client-callback – simplicity vs. performance
In light of the rising popularity of AJAX during the last couple of years, Microsoft wanted to include the feature natively into ASP.NET’s object model. They came up with an elegant solution for the feature in ASP.NET...
-
Do more with a DataTable and improve performance
There are some features in the System.Data.DataTable class that a lot of developers don’t utilize. I base that statement on different code samples I’ve seen on blogs and article bases during the last couple of years...
-
Working with weeks in C# - not that obvious
For some reason, Microsoft didn’t add a Week property to the DateTime class. I never could figure out why. Instead they gave us the System.Globalization namespace, filled with date related functionality like the...
-
Traceworks is hiring a new ASP.NET developer
Traceworks is looking for a new ASP.NET front-end developer : "You are enthusiastic about new technology and know all about what’s going on the in the world of online development, on demand solutions, etc. At night you...
-
The true ASP.NET developer
ASP.NET is a double sided discipline that demands skills and understanding of two very different worlds: the web as a platform and .NET development. The problem is that it is hard to find an ASP.NET developer that is...
-
Dell’s new corporate blog vs. Channel 9
For a lot of good reasons I’m sure, Dell just launched their new blog one2one in order to communicate directly with their customers. It even has video entries or vlogs, which I think is great and very informative as...
-
HttpHandlers in ASP.NET without regions
I work a lot with httphandlers (.ashx) in ASP.NET – mostly to generate dynamic XML files for Macromedia/Adobe Flash consumption. It works great and the performance is great in httphandlers compared to webforms, but there...
-
Create performance counters using .NET and C#
Today, I had to implement custom performance counters in one of our applications. I haven’t worked much with performance counters before, so I wanted to check the Internet for some good articles and maybe some helper...
-
Simple FTP file upload in C# 2.0
Sometimes you just want a simple function to perform a simple task. There are a lot of FTP libraries for free download on the Internet, but if you simply want to upload a file to an FTP server in C#, these libraries are...
-
Turn URLs into hyperlinks in ASP.NET
Today, I needed a function that would look through some text input and check for any URLs and the URLs should then be turned into hyperlinks. In other words, I had to turn this www.someurl.com into <a...
-
Validate a GUID in C#
I recently needed to validate a GUID in C# and found this article on how to do it. I've simplified it to make it suit the problem I was trying to solve. Here's what I did with it: private static Regex isGuid = new Regex(...
-
Web statistic applications do not agree
Working in the web marketing statistics business, I know how difficult it is to produce reliable statistics about visitors and their actions. A good web stat application, whether it is behavioral or marketing related...
-
What makes a good programming book?
During the last couple of years, I’ve been reading quite a few books about various programming topics and related technologies. Some of them take a very practical approach with a lot of examples and some take a more...
-
Use If-Modified-Since header in ASP.NET
If you are building a high traffic website, you are probably concerned about bandwidth. Many hosting centres charge based on the amount of bandwidth you use, and it can be rather expensive for high traffic sites. This is...
-
Extending the Test Browser
In my efforts to improve the web developer's Test Browser , I have now added 3 new feature. Cookie watcher (the name and value) Link list window (the URL, title- and accesskey tag) Image list window (the URL and alt tag)...
-
Testing the size of the viewstate in ASP.NET
When you are developing an ASP.NET web form, you want to make sure that the viewstate isn't larger than it has to be. The more viewstate you've got, the longer the page takes to render in the browser. I have often seen...
-
A web developer’s browser
As a web developer, I do a lot of testing against different browsers and validating to W3C standards. These are the two things I spend most time doing when testing the HTML interface. It has become a common thing to do...
-
Bind fonts to a dropdownlist in C#
I recently had to make a dropdownlist populated with fonts. Luckily, .NET allows you to use the installed fonts very easy. First, add a drowdownlist to your ASP.NET page like this: <asp:DropDownList runat= "Server" id=...
-
Remove whitespace safely at runtime
A couple a months ago, I wrote how to remove whitespace from an ASP.NET page . However, the whitespace removal was to extreme for most websites. It mangled with the HTML to such an extent that only very simple websites...
-
Cache dynamic generated images in ASP.NET
I you have an image gallery with dynamically generated thumbnails; you should make sure that the browser is told to cache the thumbnails. If not, each image is generated every time the browser visits. It stresses the CPU...
-
Which is the better syntax?
A colleague and I had a discussion the other day about the use of curly brackets in C# and when to use them. The use of curly brackets is of course a part of the C# syntax, but you can use them in various different ways...
-
The .NET CLR class that doesn’t exist
I’ve been getting a strange exception lately from my automatic ASP.NET e-mail exception logging service. It sends me this exception: The remote host closed the connection. The error code is 0x80072746. at...
-
Consolas font for ClearType screens
I just stumbled upon the new Consolas Font Pack that Microsoft recently released. The font was created specifically for ClearType screens, making it much more pleasant to read text on you monitor. I think it was...
-
Wulffmorgenthaler’s new website
new site www.wulffmorgenthaler.com went live tonight and the feedback has already been overwhelming. The website has undergone a complete renewal in both design and features to give it a more modern look and feel. It was...
-
Force length on integer in C#
Today, I had to do file renaming on 1.000 files in a directory so they could be sorted alphabetically. I will not go into details, but it was a lot trickier than anticipated because the original filenames where very...
-
Tips for working with strings in C# 2.0
Working with strings is something all developers do all the time. It’s probably the thing we spend more time with above anything else. In C# 2.0 many new features for string manipulation has been added, so I’ll dig into...
-
XHTML strict in ASP.NET 2.0
If you ever tried to validate a web page to the W3C standards you might have experienced some differences between the code that is generated to your browser and the code that the validators see. That's because ASP.NET...
-
Health monitoring in ASP.NET 2.0
The new ASP.NET 2.0 provider model has once again amazed me. It lets you write to the EventLog, Sql Server and WMI as standard and lets you write your own provider that monitors the different events that occurs in a web...
-
XML language list
Yesterday, I wrote about an XML country list that I couldn’t find on the Internet, so I generated one myself. That was possible because I had a list of countries in a database. But what about languages? Countries and...
-
XML country list
Today, I had to bind a list of countries to a drop down list in ASP.NET 2.0. I wanted to use an XML file to store the countries. There are more than 200 so there was not way I was going to hard code them in the HTML. I...
-
Make the GridView control accessible
The GridView is a new web control in ASP.NET 2.0 and is an improvement of the old DataGrid. One of the biggest issues with the DataGrid was the lack of standard compliance and accessibility. This has been fixed in the...
-
Firefox has an ”Almost Standards” mode
In the world of web developing there are many uncertain elements, but one thing you can always count on is the different rendering of HTML and CSS in the various browsers. A serious web craftsman tests for...
-
Resize the browser window from the toolbar
How to resize the browser without using a toolbar
-
Old ASP is easier to manage
For the past six months or so, I’ve been working on a really cool website in ASP.NET 2.0. As soon as the last bugs and design tweaks have been dealt with, we are releasing it to the world – we’re almost there. Yesterday...
-
AJAX and search engines – Do's and Don'ts
In the light of the immense popularity AJAX has received the last couple of months and the emerging tools like Atlas and AJAX.NET , I thought it was the right time to talk about the implications on search engine...
-
The art of software development
If you are new to programming or just interesting in learning how other developers approach the art of software development, you should check out Jan Schreuder's article on the subject. He tries to explain the caveats in...
-
Fix the Firefox cache problem
For some strange reason, Firefox caches ASP.NET pages even if you tell it not to. This could create problems with the back-button. Normally you can tell the browser how to cache your web page in two ways. You can use...
-
Store your settings in isolated storage
Isolated Storage is a place in Windows where .NET is grated read/write permissions by default. It is a physical folder like any other folder and is located somewhere within C:\Documents and Settings\User name\Local...
-
Refactor your ASP.NET project
Today at work i was refactoring my code as I do everyday, when it suddenly hit me that our ASP.NET projects were also refactored in a sense. For those of you who don't know what refactoring is, here's a definition. “...
-
CSLA .NET 2.0 with Generics
Last week, Rocky Lhotka returned to the .NET Rocks! online radio show with Carl Franklin , announcing the release of his CSLA.NET 2.0 business object framework. This is exciting news for anyone who uses the framework...
-
Download dasBlog theme
I’ve had some requests from other dasBlog users that I should make this design available as a theme for download. That was actually my plan from the beginning, but I haven’t gotten around to it before now. I wanted to...
-
Atlas – the new AJAX engine for ASP.NET
Atlas is an ASP.NET control collection for creating AJAX enabled websites. It is also developed by the man who brought us ASP.NET some years ago, the one and only Scott Guthrie . The idea behind Atlas is to make it easy...
-
The one true rich text editor
Just this moment, I am writing this sentence in a rich text editor here on my blog. It let’s me format text, insert images, tables and a lot of other great stuff as well. I can do bold or italic fonts, which helps...
-
Generate random password in C#
I recently had to make a method that creates a random generated password in C#. So, I looked at the web for such a function and I found this one . It was really simple and short and just what I was looking for. But...
-
Do not catch general exception types
If you use FxCop , then you are probably also aware of this rule . Exceptions should only be catched if they can be handled. A lot of exception handling code I’ve seen, are handling exceptions that could easily be...
-
10 - the new community site from Microsoft
10 is Channel 9 's new community sister site loaded with videos and blogs. There is, however, a great difference between the two. Where Channel 9 is about the people within Microsoft who build software, 10 is about...
-
Calling GC.Collect from ASP.NET
It can be a risky business to manually intervene with the Garbage Collector. You have to trust it to know how to manage the memory efficiently. Otherwise you could end up stressing the web server unnecessary or even...
-
AJAX used the right way
I find AJAX to be a great way of combining server-side and client-side experiences. Its' the perfect example of synergy, where the whole experience is greater than the sum of it's parts. Having said that, a lot of...
-
GhostDoc for XML code comments and documentation
"GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments." I have known about GhostDoc for some time now, but didn’t believe it to be very useful in any way. I expected it to...
-
A .NET resource editor application for .resx files
Working with resource files (.resx) in Visual Studio 2002/2003/2005 is very easy and straightforward. A .resx file is a fairly simple XML file that can be used for a lot of things. Where I have used it the most is for...
-
Book review: Test-Driven Development in Microsoft .NET
I have unit tested my code for years now, but have never got around to using a unit testing framework like NUnit . I’ve been dancing around it for some time now, but haven’t had the time to get to know it or maybe I just...
-
Implement PICS and P3P in ASP.NET headers
PICS (Platform for Internet Content Selection) and P3P (Platform for Privacy Preferences) are two really nice things to be aware of when developing web applications. If your website targets children, maybe you sell toys...
-
World Community Grid please step it up
Grid computing is a very efficient and cheap way of creating super computers. It works by connecting a lot of computers together to form a kind of a network or grid, hence the name. The more computers connected, the more...
-
Remove HTML tags from a string
A lot of websites allow users to input text and submit it to the site. This could be forums, blogs, content management systems etc. Imaging if the user writes HTML into these form fields? It could be perfectly harmless...
-
Create beautiful thumbnails from gif images in ASP.NET
There are a lot of tutorials on the web about making thumbnails in ASP.NET. I’ve used some my self over the years. They all show how easy it is, but they all lack some fundamental functionality: Create good thumbnails...
-
Convert HTML tags to lower-case for XHTML compliance
The XHTML definition demands all tags to be lower-cased. Your page will not validate otherwise and will therefore not be valid XHTML. If you write all your XHTML by yourself, it shouldn’t be an issue. You simply write...
-
Make accessible menus in HTML
I you want to make your website validate the WAI or Section 508 accessibility guidelines, you have to separate adjacent links with more than white space . You actually have to do a whole lot more, but separating links is...
-
Web 2.0 has no actual value…
As you may have noticed, discussions about Web 2.0 have been going on here and at The Dojo for the last couple of weeks. It seems to me that developers take one stand and designers/marketeers another. Today I read the...
-
Close popups by pressing the ESC key
If you often use shortcut keys to navigate the web or any other program for that matter, you probably expect the ESC key to close popups and message boxes (alerts). When using popup windows on the web, this is however...
-
Force x number of rows in a GridView
Today I had to find a way to force x number of rows on a GridView. The problem is that if the GridView.PageSize is larger than the number of rows you are data binding, the GridView itself gets smaller in the height. You...
-
What happened to nDoc?
I used nDoc all the time back in the days of Visual Studio 2003. nDoc is a tool that creates documentation based upon the XML comment you write in your source code files. Then came VS 2005 and, as far as I understand...
-
The buzz word hype and web 2.0
As you may know by now, I’m not a sucker for buzz words. On the contrary, I like facts, logic, and good old thinking. Not some new fashionable buzz word about something that really isn't new or any more exiting than it...
-
Book review: Getting Real by 37signals
The product manager at Traceworks and my boss, Morten Wulff , sent me the eBook Getting Real by 37signals on e-mail last friday. I was a little reluctant to read it, because it was written by the guys from 37signals...
-
New design and dasBlog theme
I redesigned this blog yesterday because the old design was pretty boring. The idea is to keep the design as clean and simple as possible, but still be nice to the eye. I'm not sure it is good enough yet, I feel like...
-
IE is the slowest AJAX browser
I really hoped that IE7 with it's new XMLHTTP engine (AJAX engine if you will), would out perform the old IE 6 by far. IE 6 is the slowest of the main browsers out there. Firefox and Opera is much faster processing AJAX...
-
The old confirm button trick
You have probably at some point clicked the wrong input button on a web page, and something bad happened. You deleted the wrong user, submitted to the wrong newsletter or something similar. Wouldn't it have been nice if...
-
Format the size in bytes
Earlier today, I posted a method that returns the total size of a directory, including all subdirectories. It returns the bytes and not kilobytes, megabytes or gigabytes, so I write a little formatting method to do just...
-
Calculate the total size of a directory in C#
For some reason, you cannot retrieve the total size of a directory in .NET, including subdirectories, without a workaround. I always found it odd, that some of the most basic features is not implemented in the .NET CLR...
-
Aardvark'd vs. The Code Room
My boss bought the DVD Aardvark'd from Joel Spolsky ’s company Fog Creek. It’s about the development process of a software product, and it was meant to be an inspiration for us developers. I watched the whole thing with...
-
Usability vs. accessibility
Most people are not recognizing the possibilities of an accessible website. They do however see the benefits of usability. This is a start, because accessibility IS usability. Usability IS NOT accessibility. When...
-
Accessibility from within
Accessibility is an abstract concept for the average web designer/developer, because he or she has never needed accessible web pages. A lot of people say that we all benefit from pages made accessible ( here's one ). One...
-
Override the html form in ASP.NET for URL rewriting
If you are using URL rewriting, the ASP.NET HTML form tag doesn't support it. You have to override the form tag in order to make it work. It was a bug in ASP.NET 1.x and still haven't been fixed in 2.0. Here is the class...
-
Serialization helper class in C# 2.0
I recently faced the challenge of creating the functionality that allows a class to be saved to disk. Normally I would use databases or other structured format like XML, but this time, the classes were invalid. Invalid...
-
Client Callback and Page.IsPostBack
I just spend ½ hour trying to find out, why my client callbacks where executing code inside the if (!Page.IsPostBack) region of my Page_Load method. It turns out, the Page class in .NET 2.0 has now got a new property...
-
Visual Basic functions in C# 2.0
If you used to be a VB developer, but for some reason are writing C# now, you probably miss a couple of functions. I remember being a little frustrated when I did the conversion from VB.NET to C#. It was March 2005 and I...
-
Talking about storage capacity
Check this out, it's crazy I tell ya, crazy. The CERN institute writes " The Large Hadron Collider (LHC), currently being built at CERN near Geneva, is the largest scientific instrument on the planet. When it begins...
-
Changed the name of the blog
I just changed the name of this blog from ".NET stuff" to ".NET slave". Why? Because I'm a slave, baby! A slave to the code. Q : That sounds awfully geeky! A : I know, I've got issues Q : Are you truly a slave? A: Yes!...
-
Book review: Naked Conversations
just finished reading Robert Scoble's and Shel Israel's book Naked Conversations . It's about corporate blogging and " how blogs are changing the way businesses talk with customers ". This falls in the category I call...
-
Export a DataTable to XML and CSV
If you have a DataTable or DataView you want to export to XML or CSV, I will show you have to do just that. The CSV format is also compliant with Excel, which in my opinion makes it the best suited format for...
-
Munich by Steven Spielberg
Tonight, me and a couple of friends watched Munich. We were looking forward to seeing it, hoping it would have some of the same qualities as Schindler's List. But it didn't. It was one of the most boring movies I have...
-
Remove whitespace from stylesheets and JavaScript files
There is a lot of whitespace in both stylesheets and JavaScript files. This is because of indented text and line breaks to name a few. They are typically also filled with comments to make them more maintainable. Believe...
-
The forgotten performance optimization tricks for ASP.NET
There are a lot of articles explaining the basics in performance optimization in ASP.NET. Here is one and here is another . It is important to know the basics and use them where appropriate. The basics include caching...
-
Plan ahead to avoid surprises
A couple of colleagues and I talked about how unpleasant surprises could be avoided if you use the time needed to research the task before actually starting to work on it. It turned out, we all did it in our own distinct...
-
Compact a Microsoft Access database from .NET
Over time, a database becomes fragmented when it is used. This makes it grow in size and perform badly. Not the two qualities you want for your mission-critical data. Luckily, a lot of databases such as MS SQL Server and...
-
Create vCalendar items from ASP.NET
I recently build a web application that would let visitors add calendar items to their calendar program like Outlook or windows mobile smartphone, just by clicking a link and download the vCalendar item. vCalendar is a...
-
Remove whitespace from your ASP.NET page
In a normal webpage there is a lot of whitespace. We put it there in form of tabs and carriage-returns in order to make the document more maintainable and easier to read. But it has its price in terms of adding to the...
-
.NET Profiler
What happened to that fantastic little tool that would find your memory screw-ups in a nice and friendly manor? I have been looking for a profiler for .NET 2.0 for the past year or so, when Visual Studio 2005 was still...
-
AJAX - because there is no alternative
Say what???! <quote> AJAX is the most promising and coolest thing happening in the web world at the moment – a part of the web 2.0 movement! </quote> If you read any web 2.0 blogs it seems that IT IS the web 2.0...
-
Internet Explorer 7.0 beta 2
For those of you who tried the beta 1 release, you would agree that a lot has happened since then. The design has improved, the RSS aggregator feature has improved along with a lot of things. The tabbed browsing also...