Mondor’s ASP.Net CAPTCHA Control is, by far, one of the great free CAPTCHA controls available for .Net community.
UrlRewritingNet.UrlRewrite is a super cool URL rewriting plugin that I’ve come to using on almost each and every project of mine.
Now the problem was created when I tried to use both of them on the same project. I configured the
<httpHandler/> as specified on Mondor’s page, but the CAPTCHA image never showed up.
Why? Because, UrlRewritingNet module was intercepting all requests to non existent items, including CaptchaImage.axd which is used by Mondor’s CAPTCHA control, before the
httpHandler can get hands on the request pipeline.
While I tried a couple methods to overcome the situation including this one typical method where I analyzed the code using Reflector and then writing a custom GenericHandler(CaptchaImage.ashx) and created a stream filter to replace
Finally, the solution came from where the problem was created. The UrlRewritingNet module. Here are the steps that you can use to resolve the problem.
First of all, create a Generic Handler, say,
CaptchaImage.ashx at the root of your application with the following code.
<%@ WebHandler Language="VB" Class="CaptchaImageHelperHandler" %>
Public Class CaptchaImageHelperHandler
Now, all we need to do is rewrite
CaptchaImage.axd to this file using, you guessed it right, UrlRewritingNet module.
Here is a sample configuration line for you.
And you are done. You don’t have to modify your existing code and for a person like me, that is a greatttt relief.