Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Thoughts on .Net & Coding

.Net Articles, tutorials, reviews, code and more...

  • Implementing Website Pinning in ASP.NET

    Internet Explorer 9 introduced a new feature - Pinned Websites - that allows you to create a shortcut to a website on Windows 7 taskbar. A pinned website, however, exposes much more functionality than an ordinary shortcut. Normally to launch a website, the user needs to open a browser instance, type in website URL in the browser address bar and then navigate to the required part of the website. Pinning a website allows the user to launch it much like a desktop application. The user can simply click on the icon of the pinned website or select a specific option from a menu and start working with the website. Since a pinned website is always visible on the taskbar, website pinning also grabs constant user attention. This can result in significant increase in the usage of the website for obvious reasons. No wonder that every ASP.NET developer would like to take advantage of this feature in their websites. To that end this article discusses various steps involved in enabling pinning for your website. It also illustrates creating static and dynamic task entries and discusses a few other scenarios specific to ASP.NET.

  • Aggregating RSS Feeds - Quick code sample

    .NET framework provides classes to read and write RSS and ATOM feeds. I already wrote a couple of articles illustrating the use of these classes. These classes reside in System.ServiceModel.Syndication namespace and primarily work with one feed at a time. Sometimes, however, you need to aggregate multiple feeds to create a single feed. The code sample below shows you how to accomplish this in an ASP.NET web form.

  • HTML5 Form features you should know

    In the past few articles I discussed HTML5 features that every ASP.NET developer should be aware of. In this article I will focus on HTML Forms and discuss some enhancements that make your life easy. Merely using various input types is just one part of the story. You should also know HTML5 features that are applicable to the form as a whole. This article illustrates some such features. All the examples use Chrome as a browser but many can be tested in Safari, Opera and others.

  • Introduction to HTML5 for ASP.NET Developers

    More and more web applications are harnessing the power of client side features of a browser. To that end HTML5 has many features to offer web developers. HTML markup, JavaScript and CSS have become more powerful and flexible than ever before. ASP.NET Developers must be well-versed with HTML5 features because all of the leading browsers are aggressively supporting them and newer web applications are bound to rely heavily on them. This article is intended to give you an overview of some key features of HTML5 from a developer's perspective. We won't go into too much detail of new HTML tags, CSS3 and such "markup" level features, instead we will focus on features more appealing to web developers.

  • Working with HTML5 Canvas

    One of the reasons for the popularity of the web is the graphical user interface offered to the end users. Images, animations, fonts and other interactive effects make a website appealing from an end user's perspective. However, one limitation that website developers often encounter is drawing graphics in the browser. As a solution, developers often resort to Flash or Silverlight based plug-ins or generate graphics on the fly at server side and then send it to the client. HTML5 does a great job in client side graphic rendering by offering what is known as canvas. The actual drawing can be carried out using JavaScript code and certain new graphic objects. Understanding HTML5 canvas and associated JavaScript objects is important for any ASP.NET developer and this article teaches you just that.

  • Using HTML5 input types in ASP.NET

    HTML5 introduced several new input types for <INPUT> element. These new input types include number, range, email, url, color, date, datetime and a few more. Though these types are not fully supported by all desktop browsers any ASP.NET developer should know them because newer browser versions will definitely support them. In this article you will learn the basics of using the new input types. More importantly you will also learn to use them with ASP.NET Web Forms and ASP.NET MVC applications.

  • Introduction to Entity Framework Code First

    Entity Framework (EF) allows you to program against a model instead of dealing with a database directly. In EF 4.0 (that ships with .NET 4.0) you typically design a model from an existing database visually, using a designer provided for that purpose. EF 4.1 builds on top of what EF 4.0 provided and allows you to create models directly at code level. That means instead of creating any database and then using a designer to define models, you create plain .NET classes and then use EF 4.1 techniques to make them EF models. This approach is referred as Code First because you focus on the source code of the model classes first. Once the models are ready Code First can also generate database tables out of those model classes. In this tutorial you will learn the basics of developing an application using Entity Framework Code First.

  • Emitting Exceptions from LINQ to SQL classes in ASP.NET MVC Validation Summary

    Recently while developing a sample application in ASP.NET MVC, I came across a peculiar situation. There was a LINQ to SQL class with several extensibility methods defined (OnXXXXChanging kind of methods where XXXX is the name of a property). The methods were performing some validation checks and in case of any violation were throwing exceptions. The LINQ to SQL class was working fine. However, at some places I wanted to display the validation errors (thrown by the class as exceptions) on the ASP.NET MVC views. That is where the problem began. No matter what exception you throw in the class the Validation Summary never displays the error message.

  • Generating Code Using Text Template Transformation Toolkit (T4)

    Many times developers come across situations where they need to write similar code over and over again. Automating the generation of such boilerplate code not only reduces the time spent but also reduces the chances of errors while doing such monotonous development. To help developers achieve this goal, Visual Studio 2010 includes what is known as Text Template Transformation Toolkit (T4). T4 templates are text files that specify the structure of the code or markup to produce. T4 comes with its own set of directives and blocks, which allow you to you define the boilerplate for code generation. This article introduces you to T4 basics and familiarizes you with the various parts of a T4 template.