Archive for the ‘ASP.NET C#’ Category

.NET Streams cheatsheet

Thursday, November 19th, 2009

A summary of streams in .NET. TextReader [abstract] -----> StringReader -----> StreamReader TextWriter [abstract] -----> StringWriter (uses underlying StringBuilder) -----> StreamWriter

ObjectDataSource : how to set insert / update parameters programmatically

Tuesday, November 10th, 2009

Having begun programming with ASP.NET from its inception where you wrote your own solutions to common problems, I've found the introduction of ObjectDataSource objects and similar functionality a blessing and a curse. Although they can save a bit of coding I always find my self wasting lots of time trying ...

How to get the parts of a URL in ASP.NET

Tuesday, June 30th, 2009

Every time I need to parse a URL or to extract parts of a URL in ASP.NET C# I can never remember what I did last time and need to refer to the documentation. So, in order to quickly answer the question "How can I get the elements of a ...

LINQ TO SQL : WHERE X IN ()

Monday, June 22nd, 2009

I recently needed to do a WHERE X IN () style query using LINQ to SQL. Here's the solution I used:

Extension methods (C#)

Monday, June 8th, 2009

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written ...

yield return (C#)

Monday, June 8th, 2009

The yield keyword signals to the compiler that the method in which it appears is an iterator block. The compiler generates a class to implement the behavior that is expressed in the iterator block. In the iterator block, the yield keyword is used together with the return keyword to provide ...

ASP.NET - what is the App_Data folder for?

Sunday, November 30th, 2008

In addition to supporting server databases, Visual Studio 2005 / 2008 also supports local databases in an App_Data folder. Finding a clear answer as to what the folder is for was not easy but my basic understanding is this:

.NET Data Access strategies overview

Saturday, November 29th, 2008

Due to the increasing number of data access strategies being introduced to .NET with little guidance on which to use I decided to create an overview of the different methodologies available. This is really just a cheatsheet for myself but maybe it's useful to others as well...

How to cache portions of ASP.NET pages

Monday, June 2nd, 2008

This article will demonstrate a complex and real world example of how to implement ASP.NET output caching on portions of your pages. My next article will explain the more difficult task of how to programmatically clear the cache whenever you choose!

Prevent session timeout in your ASP.NET AJAX application

Thursday, May 29th, 2008

Here's an interesting problem I encountered recently. With a traditional ASP.NET web application each time a user requests a page from the server, the server will reset the user's session timeout counter and hence prevent the user's session from timing out. However, suppose I have an AJAX.NET application which is ...