Compartilhar via


An ASP.NET Framework for Human Interactive Proofs

An article I recently wrote for MSDN online just went live:
An ASP.NET Framework for Human Interactive Proofs

It's always fun when that happens :)

Comments

  • Anonymous
    September 23, 2004
    Have to say, congratulations on the article. Great coverage of a very topicval subject!

  • Anonymous
    September 23, 2004
    Thanks, Scott! Glad you like it.

  • Anonymous
    September 28, 2004
    This article seems to have covered all the current angles and is well worth the read.

  • Anonymous
    October 11, 2004
    Thanks for the article, Stephen!

    Would you please point the way Words collection can be set for ImageHipChallenge. I've tried to set the collection using VS designer collection editor, but it throws error message [Constructor on type System.String not found].

    Thank you in advance.

  • Anonymous
    October 12, 2004
    Anton, I've post an answer to your question at http://blogs.msdn.com/toub/archive/2004/10/12/241277.aspx. Hope that helps.

  • Anonymous
    August 03, 2005
    I have recently tried to use your controls but am having trouble. The image only displays periodically but I get no errors. It displays correctly if I run the page locally or without the validator control in place but I haven't isolated it any further. Any suggestions. Thanks

  • Anonymous
    February 27, 2006
    How to get this control to work (Page_Load) inside a FormView or any other data-bound control?

    This works :
    Me.ImageHipChallenge1.Words.Add("test")
           
    This doesn't:

    Dim row As FormViewRow = Me.FormView1.Row
           Dim hip As ImageHipChallenge = CType(row.FindControl("ImageHipChallenge1"), ImageHipChallenge)
           hip.Words.Add("testing")

    Throws the exception:

    No words available for challenge.

    HipChallenge.cs
    protected virtual string ChooseWord()
    {
    if (Words.Count == 0) throw new InvalidOperationException("No words available for challenge.");
    return Words[NextRandom(Words.Count)];
    }

  • Anonymous
    May 12, 2006
    Nice work this code works great for me!  

    In response to Shaun Slocumb's post above.  I had the same problem; it works fine locally, but not when deployed to W2003 server. The problem was caused by fonts specified in ImageHipChallengeHandler.cs that were did not exist on the server. I removed "Stencil" and "Century Gothic" and now it works fine.

  • Anonymous
    May 13, 2006
    The comment has been removed

  • Anonymous
    May 14, 2006
    The comment has been removed

  • Anonymous
    September 18, 2006
    Is there a sample available on the steps on how to use this ? Being a beginner but like the concept making it difficult to implement.

  • Anonymous
    December 05, 2006
    The comment has been removed

  • Anonymous
    December 05, 2006
    Hi Stephen, Ok, I resolved the issues I was having in my previous post (ensure you're using the correct App pool with a user accout with sufficient privileges).   The new issue I'm having regarding this is that it creates a .wav file that is only 1k in size with no audio in it.  If anyone has any ideas how to resolve this, it would be greatly appreciated.

  • Anonymous
    December 14, 2006
    Hi Stephen, Your HIP Challenge appears to work most of the time.. however occasionally the following code returns null into "string text" and there fore doesnt render a image. which seems to suggest the cache is not finding the ImageHipChallenge.ID_KEY this is the part of the code.... string text = HipChallenge.GetChallengeText(new Guid(queryString[ImageHipChallenge.ID_KEY]));            if (text != null)            {                // We successfully retrieved the information, so generate the image and send it to the client.                HttpResponse resp = context.Response;                resp.Clear();                resp.ContentType = "img/jpeg";                using (Bitmap bmp = GenerateImage(text, new Size(width, height)))                {                    bmp.Save(resp.OutputStream, ImageFormat.Jpeg);                }            } any ideas on how to fix this?? thanks

  • Anonymous
    December 17, 2006
    If the cache is being cleared, there could be several factors.  For example, memory pressure could cause resources stored in the cache to be evicted.  Or if the ASP.NET AppDomain hosting this site restarts for some reason (due to health monitoring, a change to a dependent file, etc.), the cache would also be cleared.  I'd check for signs of any of those.

  • Anonymous
    May 24, 2007
    I am getting error ,font famally not found please any one can send the source code for it

  • Anonymous
    May 24, 2007
    where is this file ImageHipChallenge.aspx,we need to create this file ?i am not understanding if u got then send the file

  • Anonymous
    July 02, 2007
    Can you guys post the aspx page here? Thanks

  • Anonymous
    July 10, 2007
    i am not getting  ImageHipChallenge1.Words ...where to add words?

  • Anonymous
    April 29, 2008
    Hi there, Ive been having problems with the Words property. The get/set statements dont seem to work as you would expect. is the following correct? [EditorBrowsable(EditorBrowsableState.Always)]        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]        [Editor(        "System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",        "System.Drawing.Design.UITypeEditor,System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"        )]        public StringCollection Words { get { if (_words == null) _words = new StringCollection(); return _words; }            set            {                _words = value;            } }

  • Anonymous
    April 29, 2008
    plugging the above code into the solution produces a stringcollection editor within the designer that apparently works. However, the words colletction doesnt seem to ever get initialized, and throws the "no words available" exception at runtime. I know that its very bad practice to try to populate the words collection through the control properties at design-time, but I want to get it to work more as an academic exercise, and Im completely stuck as to why the Words colletction isnt being populated by the stringCollection editor.

  • Anonymous
    October 23, 2008
    I'm not receiving any errors.  However, the image is not showing for me at all.  I'm able to validate that the word that I set is validated, but the image is never displayed.  Can someone please let me know what might be causing this problem? Thanx

  • Anonymous
    January 08, 2009
    Just use a huge ditionary file Huge.txt and randomly add a word to the imagehip collection. Example: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load            'get the LotsofWords.txt file and parse it into an array collection            Dim intWords As Integer            Dim objReader As New StreamReader(Server.MapPath("~/LotsofWords.txt"))            Dim sLine As String = ""            Dim arrText As New ArrayList            Dim intItem As Integer = 0            Try                Do                    sLine = objReader.ReadLine()                    If Not sLine Is Nothing Then                        arrText.Add(sLine)                    End If                Loop Until sLine Is Nothing            Catch ex As Exception            Finally                objReader.Close()            End Try 'Shake and Bake it baby!!            arrText.Sort()            arrText.Reverse()            intWords = GetRandomNumber(0, 936)            Dim strItem As String = Nothing            Try                strItem = arrText(intWords).ToString()            Catch ext As Exception                strItem = arrText(5).ToString()            Finally                'add the arrtext to the hip challanger                ImageHipChallenge1.Words.Add(strItem)            End Try        End Sub        'create the random object constructor using the datetime seconds        Dim objRandom As New System.Random(CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))        Public Function GetRandomNumber(Optional ByVal Low As Integer = 1, Optional ByVal High As Integer = 100) As Integer            ' Returns a random number,            ' between the optional Low and High parameters            Return objRandom.Next(Low, High + 1)        End Function

  • Anonymous
    June 09, 2009
    PingBack from http://jointpainreliefs.info/story.php?id=1100