BlogEngine.NET custom captcha

One of the biggest flaws with my blog was that there was no CAPTCHA  ("Completely Automated Public Turing test to tell Computers and Humans Apart.)  Wikipedia article here.

I was getting comment spammed.  This I hope will reduce if not eliminate BOTS from putting false comments into my blog.  BOTS do this to increase their ranking on search engines in order to get more hits to their sites, when a keyword is entered.

Upon looking at the code for BlogEngine.NET, I did notice that there looked like there was some DEV in the area of the CAPTCHA, but it wasn’t fully implemented.

There is still one minor security flaw in my CAPTCHA design.  Once it’s fixed I will reveal what it was and how I fixed it.  In the meantime, I’ve gone ahead and deleted all fake comments and uploaded the new code.

If you try to comment on my blog now, you’ll see a little picture with some number on it.  The picture is of one of my cats “Sneakers”.  If the number is typed incorrectly, you won’t be able to post the comment.  Some of the messaging needs fixing as well.  This is definitely a good feeling project for me.

image

24. December 2009 12:36 by Danny Gershman | Comments (2) | Permalink

Run ASP.NET Development Server without Visual Studio

Ever want to run ASP.NET development server without having to fire up Visual Studio Debugger.

You can create your own scripts or commands by being able to access this.

%WINDOWS PATH%\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.exe

Here is the command line options as shown without setting any parameters.  Enjoy!

image

5. August 2009 07:11 by Danny Gershman | Comments (3) | Permalink

URL Rewrites in WCF

I had posted an entry to StackOverflow earlier today.  But I was able to resolve before I got an answer.  When handling URL rewrites in WCF, it’s important to include the trailing forward slash in the URL.  You can this in my example below.

 

public class FormatModule : IHttpModule
{    
#region IHttpModule Members    
 
     public void Dispose()    
     {       
          throw new NotImplementedException();   
     }   
    
     public void Init(HttpApplication application)    
     {        
          application.BeginRequest += new EventHandler(application_BeginRequest);   
     }    
 
     void application_BeginRequest(object sender, EventArgs e)   
     {       
          HttpContext context = HttpContext.Current;       
          if (context.Request.RawUrl.Contains(".pox"))             
               context.RewritePath("~/Lab1Service.svc?format=pox", false);        
          else if (context.Request.RawUrl.Contains(".json"))             
               context.RewritePath("~/Lab1Service.svc?format=json", false);   
      }    
#endregion
}
 
What I needed to do was to include the trailing slash as seen below.

 

context.RewritePath("~/Lab1Service.svc/?format=pox", false);
Technorati Tags: ,,
12. May 2009 10:31 by Danny Gershman | Comments (0) | Permalink

ReBind ASPX.VB/CS (Codebehind) to ASPX

Something has happened to a solution file that I’m working with and the codebehind has been unbinded from it’s ASPX page.  Use the following technique to rebind in VS2003

image

Right-click an ASPX page and select “View Code” (You can highlight multiple ASPX pages, by using Ctrl+Click)

image

The code will now be rebinded, as see below.

image

23. March 2009 16:57 by Danny Gershman | Comments (2) | Permalink

About dannyg

dannyg has been writing software for the last 12+ years and worked with various languages and programs.  He specializes business process automation, versatile solutions and R&D.