Jim's Blog Ramblings about novels, comics, programming, and other geek topics


How to convert a street address to longitude and latitude (geocoding) via web services (Google)

Google AdSense

Several years ago, I wrote a blog entry detailing how to use geocoder.us (and Yahoo!) web services to geocode an address. Since then both web services have changed a little and I found myself needing to update my code to support non-US locations. Below is sample code showing how to use Google’s Geocoding web service to get longitude and latitude values for addresses.


Securing ASP.NET Web Sites: Form Caching

Google AdSense
What is "Form Caching Vulnerability"?

The Form Caching Vulnerability allows sensitive form fields to be cached and retrieved by another user on the same client.

CWE-525: Information Exposure Through Browser Caching


Securing ASP.NET Web Sites: Cookie Vulnerabilities

This is the first of my series on securing ASP.NET web sites. As I work through various vulnerabilities, I’ll document instructions for fellow web developers in hopes that we can help build more secure web applications. The Cookie Vulnerability falls under the common vulnerability name of "Broken Authentication and Session Management."

What is "Broken Authentication and Session Management"?

This cookie vulnerability is OWASP 2010 A3. You can read more at Top 10 2010-A3-Broken Authentication and Session Management. This threat applies to application functions related to authentication and session management not implemented correctly, allowing attackers to compromise passwords, keys, session tokens, or exploit other implementation flaws to assume other users’ identities.


Comicster Plug-In: Debugster

Debugster is a suite of debugging and development tools for Comicster. I’ll go over each of the various tools below.

  • Property Window
  • Output Console
  • Dynamic Execution

Comicster Skin: The Hero Initiative

For my first Comicster Skin, I decided to build a customized user interface highlighting the Hero Initiative. I’ve been a bronze member for the last couple of years (ever since I discovered the charity) and I felt that the idea of making a skin to highlight the Hero Initiative would be a great idea. At the least, I figure that it will bring a some exposure for the charity and maybe some of Comicster's users will read about the charity and become members.

A little bit about the Hero Initiative:

In late 2000, a consortium of comic publishers came up with the idea to create a financial safety net for comic creators, much in the same fashion that exists in almost any other trade from plumbing to pottery. By March of 2001, the federal government approved The Hero Initiative as a publicly supported not-for-profit corporation under section 501 (c) (3).

Since its inception, The Hero Initiative (Formerly known as A.C.T.O.R., A Commitment To Our Roots) has had the good fortune to grant over $400,000 to the comic book veterans who have paved the way for those in the industry today.

The Hero Initiative is the first-ever federally chartered not-for-profit corporation dedicated strictly to helping comic book creators in need. Hero creates a financial safety net for yesterdays' creators who may need emergency medical aid, financial support for essentials of life, and an avenue back into paying work. It's a chance for all of us to give back something to the people who have given us so much enjoyment.

The Hero Initiative, www.heroinitiative.org


Comicster Plug-In: Auto Save

My third Comcister Plug-In is to create an “auto save” feature that will automatically save my comic book collection without requiring me to click the “save” button. This auto-save feature will check every 60 seconds to see if the comic book collection has been modified and if so, then save the collection.

I’m re-using some of the code from my previous plug-in (Create Backup of Collection) and adding in a timer with an interval of 60 seconds. This plug-in also implements the newly created IToogleTool interface to allow changing the state from on/enabled to off/disabled. When enabled, a checkmark will appear next to the menu choice. If the extension is in the off/disabled mode, then the timer will not execute and auto-saves will not occur.


Comicster Plug-In: Create Backup of Collection

The second Comicster Plug-In I created was for the purpose of making backup copies of my collection. Although my collection isn’t huge, I feel that entering all of the data and having to go through all of my comics to get an accurate list was enough effort to merit making regular backups. With this plug-in, it only takes 1 click to safely create a back up and store it.

The easy way to accomplish this would be to use:

File.Copy(collection.FileName, backupFileName);

But that wouldn’t be any fun, so I did it a bit more complicated so that I could learn a bit more about how Comicster works. I used the below code to write out the collection in the CMXX format.


Comicster Plug-In: Reload Images

The first Comicster Plug-In I created was to assist importing of my previous Comicster v1 collection. After the import, the issue cover images needed to be refreshed/redownloaded.

The below code illustrates how the plug-in works. The code below is shown looping through each issue within the “Owned” folder within the source collection. This process is repeated for “Wanted Issued”, “Owned Trades”, and “Wanted Trades.”

foreach (Issue item in source.Owned.Issues)
   ThumbnailImage.Reload(item.Id, item.ImageSource);

How to append options to CascadingDropDown after initially populated via AJAX Web Service

The setup: Microsoft ASP.NET and AJAX Control Toolkit components

I needed to add additional dropdown options to a DropDownList web control in use by the Ajax Control Toolkit CascadingDropDown ASP.NET AJAX extender. The CascadingDropDown provided a means to get an automatic population of a set of options called by the web service. This AJAX call also passes in the parent item, so that the list items cascade (show items related to the parent control).

An example could be 2 drop down lists: Automobile Make and Automobile Model. If the user selects “Ford” from the Automobile Make drop down list, then only Ford models are listed in the Automobile Model drop down list. If the user changes the Automobile Make to “Honda”, then the items in the Automobile Model changes to show only Honda models.

I needed a way to append an “All” option to the drop down list, but I didn’t want to automatically include “All” as valid option in my Web Service. I wanted to append it on a specific form rather than as part of the data feed.

To start, you need to have a working set of CascadingDropDown web controls. I’m not to explain that set up, because you need to figure out that before you can add additional elements.


Troubleshooting Internal Error in the .NET Runtime

This problem was the most infuriating and time consuming problem that I’ve ever dealt with.  The first part of this post might be a bit of rambling, so if you want to jump to the details, just click here.

I noticed the first symptoms when I couldn’t debug a web site from within Visual Studio 2010. The below error was being shown when the local development web server was trying to load.

WebDev.WebServer40.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

I initially thought it was a bug in Visual Studio or the .NET Framework, so I verified all of the patches and services packs. After downloading and installing the Cassini development web server replacement for the default Visual Studio web server, I continued to get the same error.

The system event logs showed two error occurring relating to the vshost.exe process.

Event 1:
Application: MyWebSite.vshost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 791A8BBD (79140000) with exit code 80131506.

Event 2:
Faulting application MyWebSite.vshost.exe, version 10.0.30319.1, stamp 4ba2084b, faulting module clr.dll, version 4.0.30319.1, stamp 4ba1d9ef, debug? 0, fault address 0x00068bbd.