Latest Entries

Classic ASP Include Files in ASP.NET

calendar_today 23 June 2010 07:43

Classic ASP ASP.NET Web Forms

Include files within classic ASP are about the only way to achieve some measure of code-reuse within frameworks that offer little or nothing by way of composition or inheritance. Judging by the number of questions in forums, there are still a lot of people moving across from classic ASP who are puzzled as to how to approach replacing include files within ASP.NET. A number of articles illustrate individually how to do so for site-wide layout reasons, including widgets, reusing global functions, or actually including the content of a file. However, I haven't been able to find one resource that brings all these together, hence the purpose of this article.

Named Anchors And MVC Urls

calendar_today 14 June 2010 10:15

ASP.NET MVC

Named Anchors are used to generate links to specific locations within a web document. Unless you are careful, you may end up having a little trouble getting these to work using the MVC LinkExtension helpers.

Google Sitemap Generation From A Custom SiteMapResult

calendar_today 31 May 2010 20:42

ASP.NET MVC

My previous article showed how to use a custom ActionResult and the classes within WCF to generate an RSS feed. There are no similar classes to help build a valid Google Site Map for an ASP.NET MVC application. So here's how your can build your own.

Rss Feed Generation From a Custom RssResult

calendar_today 31 May 2010 09:14

ASP.NET MVC

When I looked at producing RSS Feeds in ASP.NET MVC before, I used the ContentResult method to return XML. Best Practice suggests that you should create a new ActionResult if required. So this article looks at creating an RssResult, and a different way to generate the feed itself.

Converting URLs Into Links With Regex

calendar_today 22 May 2010 22:56

C# Extension Method

Following on from the recent spate of extensions methods I've posted, here's another I use to convert URLs and email addresses into links within HTML. You may want to restrict users from submitting HTML tags via forms in your application, which means that URLs and email addresses that they submit appear as plain text unless they are subjected to some kind of processing.

Highlighting Keywords Found In Search Results

calendar_today 22 May 2010 19:41

C# ASP.NET 3.5 Extension Method ASP.NET Web Forms

A common question in the forums is how to highlight key words found in search results. Here's an extension method that does that, both for partial matches, or whole word matches.

jQuery News Scrollers and Tickers with a ListView

calendar_today 21 May 2010 21:12

ASP.NET 3.5 jQuery

The jQuery Cycle plug-in is most often used for creating image slide shows. However, it's just as easy to use to create a news scroller from a ListView. Here, I look a doing just that. I also look at an alternative jQuery plug-in (NewsTicker) that gives the effect of the classic BBC News Ticker.

Displaying The First n Characters Of Text

calendar_today 16 May 2010 09:59

C# ASP.NET 3.5 Extension Method

Displaying the first n characters of a block of text on a page without chopping words off halfway through is a common requirement. There are a number of ways to achieve this, but here's an extension method that you might find useful.

Sessions and Shopping Carts

calendar_today 03 May 2010 23:36

ASP.NET 3.5

Managing shopping carts using Sessions is the source of much confusion for beginners to ASP.NET. This article looks at how to do this so that items can be added and removed by customers easily before they commit to their purchase.

Book Review - Beginning ASP.NET 4 in C# and VB

calendar_today 19 April 2010 22:24

Book Review

People often post questions to the forums at www.asp.net asking what they need to learn to become an accomplished ASP.NET Web Developer. Answers vary, but tend to focus on learning the framework and a bit of SQL, along with finding your way around Visual Web Developer, or if you can afford it, Visual Studio. My answer tends to consist of the same list of items:

Validating the Contact Manager with MVC 2.0 And VS 2010

calendar_today 29 March 2010 22:17

ASP.NET MVC

The MVC 2.0 Framework was finally RTM'd on March 11th 2010, so I took the opportunity to update my Contact Manager application with some of its new features. While the focus of this article is validating the Model using DataAnnotations, I also touch on one or two other new features in the latest release.

ASP.NET MVC v. Web Forms Debate - My View

calendar_today 22 February 2010 21:53

General ASP.NET 3.5 ASP.NET MVC

It seems that the whole world (and Margate) is having its say on which is better - MVC or Web Forms. Scott Guthrie posted his views on technical debates in general, and then contributed his thoughts on MVC v. Web Forms. Ian Cooper has an interesting contribution to make to the debate too. Rob Conery (formerly of Microsoft) posted probably the most linked to opinion on the matter. (There - I've just added another link...) A lot of other blog posts around scream that MVC is better because its better. One even tries to posit the notion that some kind of score card approach can help you decide.

ASP.NET MVC is not all about Linq to SQL

calendar_today 21 February 2010 08:21

ADO.NET ASP.NET MVC

Pretty much every sample application that illustrates ASP.NET MVC uses Linq To SQL or the Entity Framework as the data access method. I've seen a number of questions posted to the forums at www.asp.net asking if there are any alternatives, and indeed there are. This article will look at using plain ADO.NET within a data access layer to provide dynamic content to a typical small CRUD application.

Using gacutil.exe and Reflection to generate the Exceptions Cheat Sheet

calendar_today 10 February 2010 07:28

C# Visual Studio General ASP.NET 3.5

The most recent addition to my Cheat Sheets features details of all the Exceptions that can be found in the most commonly used assemblies within ASP.NET development. Compiling this information was an interesting challenge. I could have simply copy-pasted from MSDN, but that would have been extremely tedious. Instead, I ended up with a blend of Linq to XML, Reflection, a dash of Regex and the Global Assembly Cache Tool - gacutil.exe. Here's the full story.

Cheat Sheet - .NET Framework Exceptions

calendar_today 07 February 2010 17:19

C# General ASP.NET 3.5

Here's a list of Exceptions that can be found in the assemblies which are most commonly used in ASP.NET development.  Ideally, you should be as specific as possible when catching or throwing Exceptions. The more specific you are, the less work the CLR has to do in locating the appropriate catch block, and the more informative your error messages are, which should help speed up identifying the source of any problems.

Simple task Scheduling using Global asax

calendar_today 30 January 2010 22:22

ASP.NET 3.5

A frequent requirement for ASP.NET developers is to schedule tasks at regular intervals. This can include site maintenance tasks, like cleaning up old files, emailing newsletters on a schedule etc. This article examines one easy option for managing tasks like these without having to configure external tools, and discusses a couple of alternatives.

Get The Drop On ASP.NET MVC DropDownLists

calendar_today 07 January 2010 21:27

ASP.NET MVC Razor

DropDownLists in ASP.NET MVC seem to cause a fair amount of confusion to developers fresh from Web Forms World. This article looks to provide you with all (well, most) of what you need to know to get your DropDownLists working in ASP.NET MVC.

ASP.NET MVC - Prevent Image Leeching with a Custom RouteHandler

calendar_today 25 December 2009 22:31

ASP.NET MVC

Have you ever noticed an unusually high number of requests in your web server log files for image files? It may well be that someone is linking to your images from their own site, and basically stealing your bandwidth. Here's how to implement a custom RouteHandler within an ASP.NET MVC application to prevent people leeching your images.

ASP.NET MVC Uploading and Downloading Files

calendar_today 21 December 2009 22:29

ASP.NET MVC

If you come to ASP.NET MVC from a purely ASP.NET Web Forms background, one of the first things you are likely to notice is that all those nice easy Server Controls have disappeared. One of those is the FileUpload, and its absence seems to cause a few problems. This article looks at how to upload files to the server in an MVC world, and how to get them back from the server to the user again.

Please Help - URGENT!!!

calendar_today 12 December 2009 10:31

General

Some one posted a comment to one of my articles the other day.  It appears that they had had little success in adapting some code I had posted in the article to their application. They included this phrase in their comment: "Please advice me, it is  urgent".