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

Chris PfeifferMilitaryAsked:
Who is Participating?
Chris PfeifferMilitaryAuthor Commented:
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~!
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
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?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Don't you need the querystring to generate the CAPTCHA image? Have you tried the site URL with the querystring like this?     
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?
Chris PfeifferMilitaryAuthor Commented:
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.
Chris PfeifferMilitaryAuthor Commented:
This site talks about the issue and a fix but not sure that I understand.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.