[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1223
  • Last Modified:

CaptchaImage

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, discountasp.net I get the red X for a picture and this as the link for the picture http://www.site.com/MFFO/CaptchaImage.ashx?

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 http://www.codeplex.com.

Thanks
Chris


'Web.Config file:
 
 
<add verb="*" path="*CaptchaImage.ashx" type="Subkismet.Captcha.CaptchaImageHandler, Subkismet"/>
 
'Page: 
 
 
   <sbk:CaptchaControl id="captcha" 
    runat="server" 
    ErrorMessage="The NO BOT code you entered is invalid." 
    Display="dynamic"
    CaptchaLength="5"
    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 = ""
            UpdatePanel1.Update()
        End If
    End Sub

Open in new window

0
Chris Pfeiffer
Asked:
Chris Pfeiffer
4 Solutions
 
PlatoConsultantCommented:
there is some error in server side image....
http://www.site.com/MFFO/CaptchaImage.ashx?
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
0
 
aibusinesssolutionsCommented:
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?
0
 
dacITCommented:
Don't you need the querystring to generate the CAPTCHA image? Have you tried the site URL with the querystring like this?

http://www.site.com/MFFO/CaptchaImage.ashx?spec=bFx6sd9EvJBG4WyaA6Pb4G6BY3woawyU%2bYCU%2bjcFLRVJ7xULK%2fuuhy8D351tK0wg     
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aibusinesssolutionsCommented:
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?
0
 
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.
0
 
Chris PfeifferMilitaryAuthor Commented:
This site talks about the issue and a fix but not sure that I understand.
http://community.discountasp.net/default.aspx?f=5&m=29784
0
 
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~!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now