Archive for March, 2008

10 Mar 2008

Localhost HTTP debugging with Fiddler

14 Comments Uncategorized

I have been a huge fan of Fiddler the HTTP Debugging Proxy for a couple years now. However one thing that always bugged me about any network debugging tool was the fact that it could not debug localhost or 127.0.0.1. However I just found a solution while racking my brain for a way to debug one of my local projects.

I don’t know if many of you are aware but the website http://localhostproxy.com points to 127.0.0.1 as a standard for URL examples.

ping localhostproxy.com

Pinging localhostproxy.com [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

So if localhostproxy.com points to the same local IP address as localhost, I figured that I could just use localhostproxy.com instead of localhost in my projects. I used the following setup:

Visual Studio localhostproxy.com Setup

With the above setup I was able to get Fiddler to monitor my localhost traffic my tricking the network card to go external for the localhostproxy.com reference.

Fiddler localhostproxy.com

So basically that is all that I needed to do and it make pretty quick work of getting around the localhost problem.

Updated: Updated domain to localhostproxy.com instead of somesite.com, because somesite.com was swallowed up by a squatter.

09 Mar 2008

ASP.NET MVC Preview 2 CAPTCHA using ActionFilterAttribute

42 Comments Uncategorized

My last article on ASP.NET MVC CAPTCHA was very well received by many of my readers and it even caught the eye of the DotNetKicks crowd. Now that MVC Preview 2 was released last week, many new features make encapsulating my CAPTCHA control even easier. Most notably is the ActionFilterAttribute which allows you to override the Pre and Post action events for any action the attribute is applied to.

Basically everything works the same as it did in the previous article. I just modified things for MVC Preview 2. To validate the CAPTCHA you add the attribute CaptchaValidation to the action.

[CaptchaValidation("captcha")]
public void Register(string userName, string password, string email, string question, string answer, bool captchaValid){
    // do stuff
}

You still need to register the CAPTCHA image handler.

<httpHandlers>
    <add verb="GET" path="captcha.ashx" validate="false" type="ManagedFusion.Web.Handlers.CaptchaImageHandler, ManagedFusion" />
</httpHandlers>

I added an extension to HtmlHelper that generates a text box with autocomplete=”off”.

<label for="captcha">Enter <%= Html.CaptchaImage(50, 180) %> Below</label><br />
<%= Html.CaptchaTextBox("captcha") %>

Which generates the following.

Example of CAPTCHA

You can view the source code for this on my Google Code Project, everything is available through SVN.

  1. CaptchaValidationAttribute.cs
  2. CaptchaHelper.cs
  3. CaptchaImage.cs
  4. CaptchaImageHandler.cs

Or you can download the project for you own personal use.

06 Mar 2008

Apple Doesn’t Get My Money For An iPhone Today

1 Comment Uncategorized

Today Apple had their big iPhone SDK press release. They opened up the phone and added a bunch of Enterprise features that many small to large corporate customers have been asking for. But they still haven’t implemented the features I am looking for in a smart phone, and until they do, they will not see my money.

  1. Microsoft Exchange Direct Push
  2. Tethering
  3. 3G Network (I currently use Verizon)

I know #2 will be coming, if not through Apple somebody else will do it, since Apple has unlocked the iPhone to developers.  However #3 is the one that I may have to wait for Verizon to switch to GSM in the distant future.  Other than my last 2 requirements I am sold on the iPhone.