Posted on 2009-02-23
Last Modified: 2013-11-07
I am having a problem with my site. I have a Captcha that works fine on the local machine, It will give an image with the follwoing link --  http://localhost:55181/CaptchaImage.ashx?spec=bFx6sd9EvJBG4WyaA6Pb4G6BY3woawyU%2bYCU%2bjcFLRVJ7xULK%2fuuhy8D351tK0wg     But when I try and use it on the Server, I get the red X for a picture and this as the link for the picture

On the webpage in dev. mode it says: Error Rendering Control - captchaAn unhandled exception has occurred.
The application relative virtual path '~/CaptchaImage.ashx' cannot be made absolute, because the path to the application is not known.

The codes is as below:

If it helps this is from the Club Starter Kit from


'Web.Config file:

<add verb="*" path="*CaptchaImage.ashx" type="Subkismet.Captcha.CaptchaImageHandler, Subkismet"/>


   <sbk:CaptchaControl id="captcha" 


    ErrorMessage="The NO BOT code you entered is invalid." 



    ValidationGroup="comment" />

'aspx page on button submit:(this should not matter as it works local as long as I have the right captcha)

rotected Sub AddComment_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddComment.Click

        If Page.IsValid = True Then

            Dim TheQueryString As Int32 = CInt(Request("id"))

            Dim mem As MembershipUser = Membership.GetUser()

            Dim gui As New Guid(mem.ProviderUserKey.ToString)

            Dim name As String = ClubStarterKit.Web.Members.FirstAndLastName(gui)

            Dim email As String = mem.Email.ToString()

            BlogComments.Insert(TheQueryString, name, email, txtComment.Text)

            txtComment.Text = ""


        End If

    End Sub

Open in new window

Question by:Chrispy2811
    LVL 11

    Assisted Solution

    there is some error in server side image....
    Server Error in '/' Application.

    The resource cannot be found.
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

    Requested URL: /MFFO/CaptchaImage.ashx
    LVL 15

    Assisted Solution

    Looks like a pathing issue, it can't find the relative path because the path is not known.  Is there a variable in the web.config file that needs to be setup for pathing for that Captcha control?
    LVL 7

    Assisted Solution

    Don't you need the querystring to generate the CAPTCHA image? Have you tried the site URL with the querystring like this?    
    LVL 15

    Expert Comment

    Well, I downloaded the Club Starter Kit, the Extended Club Starter Kit, and the ASP.NET Extended Club Site Starter Kit, and I don't see any Captcha controls anywhere...  which one exactly did you get?
    LVL 2

    Author Comment

    1) I do not get an error when I run it local.  Then when running on the server it bugs out.  I was thinking it had to do with permissions on a folder maybe but can't find anything.  But then there is an error on the developing page saying:     Error Rendering Control - captchaAn unhandled exception has occurred.
    The application relative virtual path '~/CaptchaImage.ashx' cannot be made absolute, because the path to the application is not known.

    2) the only mention of the Captcha in the web.config is :
         <add verb="*" path="*CaptchaImage.ashx" type="Subkismet.Captcha.CaptchaImageHandler, Subkismet"/>

    3) The path is random on each creation.

    4)  It is on the blog reply portion.
    LVL 2

    Author Comment

    This site talks about the issue and a fix but not sure that I understand.
    LVL 2

    Accepted Solution

    AH fixed it.  Has to do with running in IIS 7 and on the local machine

    Now that we've covered that, if your ASP.NET app has HTTP modules and you want to make sure it runs in both IIS6 and IIS7 Integrated Pipeline mode (from here on out just referred to as IIS7), you need to make some changes to web.config (there are other things to consider as well when running an ASP.NET site under IIS7, so definitely check out this article first for details). The web.config changes needed are for your HTTP modules and handlers. For IIS6, they were configured in the <system.web> section, as such:

    <system.web>    </httpModules>        <add name="..." type="..." />    </httpModules>    <httpHandlers>        <add verb="...." path="..." type="..." />    </httpHandlers></system.web>

    However, to get these to work in IIS7 you must *move them* from the <system.web> section to the new <system.webServer> section, which is what IIS7 requires when running in Integrated Pipeline mode (it's not needed for Classic Pipeline mode). So instead of the above you'd have this instead:


    <system.webServer>    </modules>        <add name="..." type="..." />    </modules>    <handlers accessPolicy="Read, Write, Script, Execute">        <add verb="...." name="..." path="..." type="..." />    </handlers></system.webServer>

    Notice there are a couple slight changes, which means you can't just copy and paste these as-is from <system.web> into <system.webServer>:

    <httpModules> and <httpHandlers> have been renamed to <modules> and <handlers>, respectively.
    Each handler in IIS7 requires a name attribute. If you don't specify it, you'll get an error message.
    The handlers node has an optional, but good-to-define accessPolicy attribute. This value depends on your handlers, so use the ones that are right for you.

    a work around would have been to switch the Application Pool Pipeline Mode from integrade to classic but it is better to get it to work with IIS 7 to get all things good!

    Points for all~!

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now