Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


Using MiniProfiler with SqlDataSource ASP.NET WebForms Control

I recently implemented MiniProfiler into an existing ASP.NET WebForms application that makes use of databinding to the SqlDataSource control. Since the SqlDataSource uses a DbProviderFactory internally, it is fairly simple to exend the control to utilize MiniProfiler through inheritance and overriding a single method of the SqlDataSource. Here’s a very simple class that inherits from the SqlDataSource control and injects MiniProfiler support to be able to profile the SQL query used by the contr... [More]

MvcMaps Preview 1 – A Unified Bing/Google Maps API for ASP.NET MVC

I spent some time lately working on bringing some of the concepts of Web.Maps.VE to ASP.NET MVC. The concepts I’m referring to are Simplicity and Ease of Development in making the implementation of mapping within ASP.NET MVC applications as simple as possible along with the Flexibility and Customizability of the Base Mapping API itself. Then I thought, Since I’m building an abstraction layer to simplify Bing Maps development, why not implement it in a flexible manor as to be able to ... [More]

Simplovation Web.Maps.VE v3.0 Now With FREE Edition!

Today, I just posted the latest Web.Maps.VE v3.0 release. The coolest thing about this new version is that is has a FREE Edition for non-commercial use! Download Web.Maps.VE v3.0 FREE Edition! There are a few new things in this latest release, but the most significant are the following performance updates: Microsoft CDN (Content Delivery Network) Support Added. This helps improve the Bing Maps content delivery speed by up to 82% JavaScript Performance Optimizations. All the JavaScript cod... [More]

Microsoft Killed the Virtual Earth ASP.NET Control

Yesterday, Chris Pendleton officially announced that the Microsoft Virtual Earth ASP.NET Control is now Dead. Frankly, I’ve considered it “dead” for a long time now since it didn’t get updated much, didn’t have a completely full feature support, has a few bugs AND you couldn’t use it within your applications because it was just a Preview (CTP) anyway. There are however a few good things to point out in the light of Microsoft killing its Virtual Earth ASP.NET ... [More]

A Simple ScriptManager for ASP.NET MVC

The ASP.NET AJAX ScriptManager makes it really easy to include JavaScript references and register JavaScript blocks into the rendered Page output of an ASP.NET WebForms application. However nice the ScriptManager control is, it’s still just a WebForms control for use with ASP.NET AJAX; thus it’s use isn’t really supported with ASP.NET MVC. Also, to make things just a little more difficult, ASP.NET MVC doesn’t have it’s own “ScriptManager” implementation.... [More]

ASP.NET MVC: Implement Theme Folders using a Custom ViewEngine

One of the things that ASP.NET MVC 1.0 is missing is the ability to easily implement Themes. The older, more mature standard ASP.NET framework includes theme support via the App_Themes folder; however limited it can be, it’s still more than ASP.NET MVC currently has. Well, at least until I wrote this little custom ViewEngine and ControllerBase class to help out and allow us to very easily implement Themes within our ASP.NET MVC applications. A little history: A few months back I wrote up a... [More]

ASP.NET AJAX: Create a JavaScript Component with Events

In the spirit of my "Mixing OOP and Event Driving Programming" article I posted a couple days ago; this article discusses how to implement the same thing using the ASP.NET AJAX JavaScript Library. Using inheritence (the ASP.NET AJAX way) it is even easier to implement a little Event Driven Model into your client-side, JavaScript classes/components. Event Driven Basics First we'll start by creating a Person class that inherits from the Sys.Component class. Now remember, sin... [More]

Custom Themes in ASP.NET MVC Updated for Preview 5

Update 2009/03/26: There is an updated version of this code (with improvements) that targets the ASP.NET MVC 1.0 RTW located here:  About two weeks ago I posted on how to Implement Custom Theme support in ASP.NET MVC. There were some breaking changes made when the Preview 5 release was released yesterday. Here's a short list to a couple of the changes I had to make to my code from the previ... [More]

How To Setup Custom Theme Support In ASP.NET MVC Preview 4 using a Custom ViewEngine

Update 2009/03/26: There is an updated version of this code (with improvements) that targets the ASP.NET MVC 1.0 RTW located here:  Update 8/29/2008: I posted a new blog post today that contains updated code for this example that works with the newly released ASP.NET MVC Preview 5. The new code is located here. One option to do theming in ASP.NET MVC is to use the standard ASP.NET Theme fun... [More]

How To Use ASP.NET MVC in Website rather than Web Application Project

I recently started getting to know the ASP.NET MVC Framework (more specifically the Preview 4 release). The first thing I noticed upon installation is that it only comes with a Web Application Project Template. There is no regular ASP.NET Website template. So, I decided to try converting the Web Application Project Template to a regular ASP.NET Website. I actually prefer to use Website projects instead of Web Application projects since it gives a little more flexibility to deploy changes to the ... [More]

C#: Generate WebPage Thumbmail Screenshot Image

There are a few services out there that serve up screenshots of any webpage for you to display on your website. One popular one is Kwiboo; this is the one that DotNetKicks uses. For some time now I've wondered what the easiest way to do this in .NET was, and today I stumbled upon the undocumented WebBrowser.DrawToBitmap method that makes this extremely easy to do. By the way, I stumbled upon the WebBrowser.DrawToBitmap while taking a look at the source code for the WebPreview tool over at SmallS... [More]

ASP.NET: Fix for WebParts + UrlRewriting/UrlMapping Issue

The problem with using WebParts with UrlRewriting (or UrlMapping) is the WebPart PersonalizationProvider uses the path of the page being rendered to save/load the personalization state, not the path that was rewritten that the user sees. So, to fix this you just need to create a custom PersonalizationProvider and override all the methods that reference path, and call the base methods but pass in the path that was requested instead of the path being rendered. Here's a SqlPersonalizationProvider I... [More]

Bing Maps ASP.NET: Web.Maps.VE v1.0 Update, v2.0 Coming Soon

Today, I released the 8th update (v1.00.08) release to the Simplovation Web.Maps.VE v1.0 ASP.NET AJAX Virtual Earth Mapping Server Control. This control has come along way since the initial (v1.00.00) release last October. It greatly simplifies the implementation of Virtual Earth into any ASP.NET web application by enabling full server-side (.net, C#, VB.NET) control of the map, while eliminating the need to write javascript/jscript. Unless of course you want to write javascript; in which c... [More]

ASP.NET 3.5: Create AJAX Extender Controls using the ExtenderControl base class

As a followup to the "Create AJAX Server Controls using the ScriptControl base class" post I wrote a couple weeks ago, I've decided to write on how to create ASP.NET AJAX Extender Controls using the ExtenderControl base class in ASP.NET 3.5. There is already an article titled "Adding ASP.NET AJAX Client Behaviors to Web Server Controls" in MSDN, but it doesn't show all the code involved in creating Extender Controls, especially the JavaScript code. What is an... [More]

Virtual Earth + ASP.NET AJAX Now Fixed in Safari

A couple months ago I blogged about the fact that using Virtual Earth and ASP.NET AJAX together on the same page caused errors in Safari. There is good new to report back, the latest update to Virtual Earth has fixed this issue. In fact Virtual Earth v6.1 actually includes much better Safari support that previous versions; it actually works correctly in Safari. I found this to be especially helpful since I can now support Safari with my Web.Maps.VE product. What's the catch? I can't... [More]

ASP.NET: Create AJAX Server Controls using the ScriptControl base class

I've been doing a lot with ASP.NET AJAX for almost 2 years now, including my Web.Maps.VE product. So, I've decided to spread some of my knowledge in this area by writing up some articles on things that I've learned and figured out. As a note, since .NET 3.5 is the "latest and greatest" version of the framework out at the time of this writing, this article targets .NET 3.5. This article also assumes you have a basic understanding of ASP.NET AJAX and JavaScript. What is ScriptControl... [More]

Some ASP.NET AJAX Tips and Tricks

I've been using ASP.NET AJAX alot for a while now, so I thought I'd share some of the Tips and Tricks that I've learned though my adventures. Lately, all the buzz has been around Silverlight, but I know there are still a lot of devs out there that can benefit from these tips and tricks. UpdatePanel Tips Use UpdateMode=Conditional By setting the UpdatePanel's UpdateMode property to Conditional, it will only update its contents when one of its triggers o... [More]

.NET 3.5: JSON Serialization using the DataContractJsonSerializer

In ASP.NET AJAX Extensions v1.0 for ASP.NET 2.0 there is the JavaScriptSerializer class that provides JSON serialization and deserialization functionality. However, in .NET 3.5 the JavaScriptSerializer has been marked obsolete. The new object to use for JSON serialization in .NET 3.5 is the DataContractJsonSerliaizer object. I'm still new to the DataContractJsonSerializer, but here's a summary of what I've learned so far... Object to Serialize Here's a simple Person object with First Name and La... [More]

Virtual Earth Plus ASP.NET AJAX Breaks In Safari!

Update 5/17/2008: This issue has since been fixed with the release of the Virtual Earth v6.1 release. There is still a small issue related to the CalendarExtender and Virtual Earth that only occurs in Safari. You can read more about it here.   I do alot of development with ASP.NET AJAX and Virtual Earth, and each of them work fine by themselves in Safari 3 on Windows. However, if you use them both on the same page, it will cause ASP.NET AJAX to break and stop working in Safari. This... [More]

Virtual Earth: Dynamically Load InfoBox Using ASP.NET AJAX

Loading alot of pushpins on the map can slow down your page in two ways: 1) Page load times can be slowed down, and 2) loading pushpins via ajax can be slow. To improve the performance (as in download and database query times) of loading pushpins on the map, you can load the Pushpin Shapes Title and Description on the fly. This allows you to only load the Pushpins Title and Description as it's needed, thus reducing the amount of data you need to send down to the client when initially loadin... [More]

Getting Started with Virtual Earth and ASP.NET AJAX

About a month ago, I wrote an article titled "Virtual Earth: Getting Started - Adding a basic Map to a page". In that article I explained the basics of using Virtual Earth with plain HTML and JavaScript. This time I'm going to explain the basics of using Virtual Earth with ASP.NET AJAX. Virtual Earth and ASP.NET AJAX Step 1: Create a new ASP.NET AJAX Web Site in Visual Studio 2005, or just an ASP.NET Web Site in Visual Studio 2008. Step 2: Open up the Default.aspx page... [More]

Web.Maps.VE - Virtual Earth Without JavaScript, plus .NET 3.5 Support just added!

Yesterday, I released the fourth update release (v1.00.04) of my Web.Maps.VE component. The main feature addition in this update is the addition of .NET 3.5 support. Below is an overview of the main features of Web.Maps.VE. For more information you can go here: Implement Virtual Earth completely from server-side .NET code; No JavaScript Necessary In case you're not familiar, Web.Maps.VE is an ASP.NET AJAX Virtual Earth Mapping Server C... [More]

12/2007: Code that I've Blogged over the last 6 months

Here's a list of links to all the different code that I've blogged over the last 6 months. .NET Framework .NET: How to Alias Namespaces and Data Types LunchTimeCoder: Windows Service Monitor that runs in the System Tray .NET 3.5: How to Convert from one TimeZone to another ASP.NET Google Charts API: an ASP.NET 2.0 Server Control Subsite Rewriting HttpModule for ASP.NET ASP.NET: RewritePath breaks HyperLink's ImageUrl in App_Theme file when path with slash is rewritten ASP.NET AJAX:... [More]

Google Charts API: an ASP.NET 2.0 Server Control

Today, I just saw that Google released their Chart API. Basically, the Google Chart API allows you to dynamically generate charts for use in your web applications. All you do is pass your data in the querystring and an image is returned. This isn't really a service to get too excited about, but it is pretty simple to use. And, it's Free. I decided to code up a small ASP.NET Server Control that uses the Google Chart API to put simple line graph charts on a page. The image on the right is actuall... [More]

Cryptographic Extensions for Microsoft AJAX Extensions Framework

The Extensions for Microsoft AJAX Framework project over at CodePlex provides cryptographic services including secure encoding and decoding of data, as well as hashing and random number generation, and new methods for JavaScript native objects. This project is pretty cool, and could really grow into a huge library offering us what Microsoft isn't putting into the AJAX Extensions themselves. And, now we have an object oriented, JavaScript way of doing MD5, SHA1, HMAC and AES! Go check it out: ht... [More]