Mondor's MSCaptcha won't load image when deployed to hosting service
Mondor's MSCaptcha control runs and displays on the local dev machine but doesn't display its genrated image when deployed to the shared server hosting service.
// what my web.config says:
<handlers>
<add name="MSCaptchaImage"
path="CaptchaImage.axd"
verb="GET"
type="MSCaptcha.CaptchaImageHandler, MSCaptcha"
preCondition="integratedMode,runtimeVersionv2.0"/>
</handlers>
Yes, I FTP the .dll(s) to the bin directory on the host server and my local code running from IIS7 on Vista runs as expected. Anything else you might need to assit please ask but I need to figure this one out as I'm stumped and note I have no control of the server at the host provider
note: I've observed somebody else has this problem as responded to at asp.net [1] lucky for me all of my Passport and Windows DeadOnArrival credentials are totally FUBAR and asp.net won't even send me a forgotten password as it doesn't know me anymore either so I can't get involed in the asp.net forums.
[1] http://forums.asp.net/p/1468509/3395243.a开发者_Go百科spx
Got it...
Web.config is Case Sensitive.. So change the Capital "C" to small "c" in captchaImageHandler
Change: type="MSCaptcha.*C*aptchaImageHandler, MSCaptcha" To: type="MSCaptcha.*c*aptchaImageHandler, MSCaptcha"
Hope this will work for you.. happy coding...:)
This worked for me, modify your web.config file
Section 1.
<system.webServer>
<handlers>
<add name="MSCaptcha" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
</handlers>
</system.webServer>
Section 2.
<system.web>
<httpHandlers>
<add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
</httpHandlers>
</system.web>
If you use form authentication then you may not be able to see the image. To resolve this add ,
<location path="CaptchaImage.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
this section in the web.config
This path should be like this: path="/CaptchaImage.axd"
in system.webServer
.
<system.webServer>
<handlers>
<add name = " MSCaptcha" verb = "GET" path = "/CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler,MSCaptcha"/>
</handlers>
</system.webServer>
I had two web configs, the config in the sub folder where the page using Captcha was updated with rights configuration.
<location path="CaptchaImage.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
The fixed the issue.
If you're using Forms Authentication then it's probably a permissions issue, so try this:
http://www.aspsnippets.com/post/2009/04/03/How-to-implement-Captcha-in-ASPNet.aspx#id_9f698584-ecb7-4fa1-99f5-797ee1a8f593
I had the same issue, I am using asp.net 5.0 vs2013
i changed my web.config as follows
<system.web>
<httpHandlers>
<add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.captchaImageHandler, MSCaptcha"/>
</httpHandlers>
<system.webServer>
<handlers>
<add name="CAPTCHAHandler" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.captchaImageHandler, MSCaptcha" />
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<location path="CaptchaImage.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
three changes to my web.config and a dll change updated the .dll from 1.0 to 4.0 Added handlers to the system.webserver Added
</system.webServer>
<location path="CaptchaImage.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
changed C to c at MSCaptcha.**c**aptchaImageHandler
it is working for me on my dev box and local.
I have solved my issue. As Web.config is case sensitive so be careful when you edit it. Here is the code of 2 sections.
<httpHandlers>
<add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
</httpHandlers>
And make sure that you put forward slash(/) for the path value
<system.webServer>
<handlers>
<add name="MSCaptcha" verb="GET" path="/CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
</handlers>
</system.webServer>
精彩评论