ASP.NET Contact Forms

by agrace 30. November 2008 07:52

ASP.NET Contact Forms I've seen some blog postings out there recently on what to do if your contact form fails for some reason. Some have suggested including your email address using JavaScript, which I do not recommend. Some people even suggest substituting "@" with "at"; if I was writing a screenscraper, this is the first thing I'd check for, after "dotcom"! If you're going to try and include your email address, then why bother with a contact form in the first place?

I've been using my own standard contact form for some time now. It displays either a success or error message upon submission. If there is an error, then it generates an email back to me. In fact, I like to have an email generated whenever there is an application error in a client's website, and I include this as part of routine error handling in my projects. This works for small projects where it is unlikely to over-burden the mail server. The strategy pattern helps me to factor out this kind of repetitive functionality; see an earlier post about this. At the end of this post, you can find a link to download a simple contact form.

ASP.NET Contact Forms


A lot of people have problems testing email with ASP.NET. The simple answer is to use a drop folder on your local machine when developing. Just create a folder called "maildrop" on your c:/ drive and use the following in your Web.config file:

    <smtp deliveryMethod='SpecifiedPickupDirectory'>
        <specifiedPickupDirectory pickupDirectoryLocation="c:\maildrop" />


ASP.NET Contact Forms


When you are ready to deploy your application, simply comment out the above entry in the config file and use the usual syntax below. Keep the drop directory section commented out in your config file as you might need it later for testing or further development:

    <smtp from="">
        <network host=""/>


For the CSS purists out there, this is created using tables because we are more interested in the functionality here. If you want a CSS contact form layout, just holler in the comments :-)

Depending on the importance of the project you are working on, you may want to log the errors to a database. This is simple to do so I'm not going to delve into it here. Note, that there is nothing to prevent you from grabbing some fine-grain error details and storing them in your errors table also. Anything that helps you identify problems at a later date is a good candidate for a table field.

That just leaves network errors. I haven't had a chance to play with this yet, but it would be nice to know in advance if the mail server was down and I'm wondering if we could somehow tap into the SMTP return status codes before sending the mail? If anyone has any suggestions along these lines, please share them here? (22.61 kb)

The ASP.NET Team have just released an amazing set of chart controls for Visual Studio 2008, with both Web and Windows versions. In addition, you can download the samples, over 200 of them, just open the project in VS and run it to see how simple it is to use them on a regular ASPX page.

ASP.NET 3.5 Chart Controls

Use the Chart Controls Add-on for Microsoft Visual Studio 2008 to add the chart control to your VS 2008 toolbox. Check the documentation for the simple steps required to do this.

ASP.NET 3.5 Chart Controls


Quoting from the new documentation:

"Chart Control for .NET Framework has the following key features:

  • Visual Studio design time support.
  • 25 distinct chart types.
  • 3D support for most chart types
  • 3D customization, including perspective, lighting, rotation, border skins, anti-aliasing, transparencies, isometric projections, shadows, and more.
  • Unlimited number of chart areas.
  • Automatic and manual layout and alignment management.
  • Automatic and manual scaling.
  • Logarithmic scaling for any base.
  • Fully customizable legends.
  • Intelligent data label positioning.
  • Chart annotations, scale breaks, interlaced strip lines, drill-down charts, tool tips, data labels, and more.
  • Zooming and scrolling. (Windows Forms)
  • Data binding.
  • Data copying, merging, splitting, sorting, searching, grouping, and filtering.
  • Data exporting.
  • Binary and XML serialization.
  • Empty data point handling.
  • Unlimited number of data series and data points.
  • Support for dates, times, currency, and more.
  • More than 50 financial and statistical formulas for data analysis and transformation.
  • Real-time chart manipulation.
  • Post-paint and pre-paint events.
  • Support for AJAX click events.
  • State management. (ASP.NET)
  • Binary streaming. (ASP.NET)
  • Animated frame rate control. (ASP.NET)"

Deep Zoom Composer

by agrace 18. November 2008 23:25

I've been meaning to have some fun with Deep Zoom for a while. I was reading Mary Jo Foley's blog posting on the new Microsoft Research project called Seadragon Ajax a little earlier but didn't make much headway. Then I realized I had already downloaded Deep Zoom Composer... what was I waiting for?!!



It will prompt you to create a free PhotoZoom account, which is basically an online photo album. You can then open you high resolution image in Composer and it will allow you to export it to your new PhotoZoom album, where it creates an embeddable link for you to use in your blog or website.

Deep Zoom


Amazing definition for a 2.5 megapixel camera. I really must try it with 10 megapixels or better. You should keep a close eye on the research website if you want to play with all the new toys for free. It's almost Christmas, right? :-O