4

i used Mscaptcha in my site. it worked fine in local , but picture was not shown in server. why?

my code in web.config :

<system.webServer>
<handlers>
<add name="MSCaptcha" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
</handlers>
</system.webServer>

in .aspx:

<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>

 <cc1:CaptchaControl ID="CaptchaControl1" runat="server" Height="50px" 
                                    Width="180px" CaptchaLength="5" BackColor="White" 
                                    EnableViewState="False" />

thanks.

Farzaneh Talebi
  • 835
  • 4
  • 22
  • 47
  • I'd venture a guess - is your server actually running in IIS Integrated Mode? If not, you have to use `system.web/httpHandlers` instead of `system.webServer/handlers` config section. – Luaan Dec 19 '13 at 16:51
  • I've posted it as an answer with some additional info, so that you can close the question :) – Luaan Dec 20 '13 at 08:39

2 Answers2

3

(posting the comment)

I'd venture a guess - is your server actually running in IIS Integrated Mode? If not, you have to use system.web/httpHandlers instead of system.webServer/handlers config section.

Since we've now confirmed that your local server is running in Integrated mode, while your remote server is running in Classic mode, you should make sure you develop with configuration as close to the production machine as possible. That might mean you'll have to install and configure IIS on the development machine (for example, Force IIS Express to Classic Pipeline Mode).

Classic and Integrated modes can be very different in practice, and you might get a lot of issues on the Classic server that don't exist on the Integrated one and vice versa.

Community
  • 1
  • 1
Luaan
  • 62,244
  • 7
  • 97
  • 116
  • Hi, even I am facing similar issue. I am using system.web/httpHandlers, still the captcha image is coming blank. How can I check whether server is running in IIS Integrated Mode or classic mode? – Arti Jul 14 '14 at 11:37
  • @user1650891 You can see the mode in the application domain list. – Luaan Jul 14 '14 at 14:35
  • Thanks, I used system.web/httpHandlers as well as system.webServer/handlers to configure Mscaptcha and it worked. – Arti Jul 15 '14 at 06:32
2

I had the same problem, the issue was caused because the .axd had no permissions. In the web.config add these lines to allow access to the .axd

<location path="CaptchaImage.axd">
<system.web>
  <authorization>
    <allow users="*" />
  </authorization>
</system.web>

William
  • 21
  • 2