locked
Implement MScaptcha RRS feed

  • Question

  • User1005758432 posted

    I followed this instruction on how to implement asp.net MSCaptcha. The problem is now, I can't use the <httphandlers> tag in my web.config anymore.

    If I do, I would get this error:

    HTTP Error 500.23 - Internal Server Error

    An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.


    Any suggestion is much appreciated.

    Thursday, November 18, 2010 12:24 PM

All replies

  • User1005758432 posted

    Okay, I ran the APPCMD, found in this article, and now I don't get the error. However, I still did not see the MSCaptcha immage showing on the page. I did go back and re-review this article and I still couldn't find the problem to why the MScaptcha image does not showed on the page.

    Help is appreciated.

    Thursday, November 18, 2010 1:08 PM
  • User1005758432 posted

    Okay, I ran the APPCM on my site and I do not get the error on my local machine as I said in my previous post but now I got the following error on web host server.

    Server Error

    <fieldset>

    500 - Internal server error.

    There is a problem with the resource you are looking for, and it cannot be displayed.

    </fieldset>

    Any suggestion?
    Thursday, November 18, 2010 1:59 PM
  • User1005758432 posted

    Well, I added this line:

    <validation validateIntegratedModeConfiguration="false"/>

    Now, I have no errors on both local and my web host space but the captcha is still not working.



    Thursday, November 18, 2010 2:12 PM
  • User1005758432 posted

    Any idea why it does not work? No errors now but it does not show up. One more thing, if you could suggest another free Captcha to me that will work is also appreciated.

    Friday, November 19, 2010 9:19 AM
  • User643723830 posted

    Hi,

    I followed the instructions from http://www.aspsnippets.com/Articles/How-to-implement-Captcha-in-ASP.Net.aspx

    Missing two more steps and it works for me (I am using Windows 7 with IIS7)

    Add the following in web.config

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

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

     

    Friday, November 19, 2010 10:16 PM
  • User1005758432 posted

    Still not working. One more question. Where should the location path to the CaptchaImage.axd suppose to be? I do not see the .axd file anywhere on my website.

    Monday, November 22, 2010 10:13 AM
  • User1005758432 posted

    For some reason I think there is something wrong with my web.confi file. Will someon take a look and tell me if there is. The reason, I've downloaded the file from this site and that sample code works perfectly. So, that's why I start to think there must be something wrong with my web.config.

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <appSettings>
        <add key="myWord" value="myWord" />
      </appSettings>
      <connectionStrings>
        <add name="myConnectionString" connectionString="Data Source=myCompName.com;Initial Catalog=myDB;Persist Security Info=True;User ID=myAdmin;Password=myPass"
         providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
        </compilation>
        <httpHandlers>
          <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
        </httpHandlers>
        <authentication mode="Forms">
          <forms name=".Authentication" loginUrl="~/Account/login.aspx" protection="None" timeout="43200" path="/"/>
        </authentication>
        <membership defaultProvider="myCompMembershipProvider">
          <providers>
            <clear/>
            <!--<add name="myCompMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="myConnectionString" 
                 enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" 
                 minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>-->
            <add name="myCompMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="myConnectionString"
                enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="myWord"
                requiresUniqueEmail="true" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordFormat="Hashed"
                maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
            <add name="SqlMembershipProviderResetPass" type="System.Web.Security.SqlMembershipProvider" connectionStringName="myConnectionString"
                 enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="myWord"
                 requiresUniqueEmail="true" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordFormat="Hashed"
                 maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
          </providers>
        </membership>
        <customErrors mode="Off"/>
        <pages>
          <controls>
            <add tagPrefix="ajaxtookit" namespace="AjaxControlToolkit.HTMLEditor" assembly="AjaxControlToolkit"/>
          </controls>
        </pages>
        <trace enabled="true"/>
        <roleManager enabled="true" defaultProvider="SqlRoleManager">
          <providers>
            <remove name="AspNetSqlRoleProvider"/>
            <remove name="AspNetWindowsTokenRoleProvider"/>
            <add connectionStringName="myConnectionString" applicationName="myWord" name="SqlRoleManager" type="System.Web.Security.SqlRoleProvider"/>
          </providers>
        </roleManager>
        <!--This section sets up a second siteMap file to be used instead of the default web.sitemap-->
        <siteMap enabled="true" defaultProvider="myComp">
          <providers>
            <clear/>
            <add siteMapFile="~/lusHmoob/lusHmoob.sitemap" name="myWordSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/>
            <add siteMapFile="Web.sitemap" name="myComp" type="System.Web.XmlSiteMapProvider" />
          </providers>
        </siteMap>
        <!--End of second siteMap declaration-->
      </system.web>
      <system.net>
        <mailSettings>
          <smtp from="contact@myComp.com">
            <network host="mail.myComp.com" port="25" userName="contact@myComp.com" password="myPass2"/>
          </smtp>
        </mailSettings>
      </system.net>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <validation validateIntegratedModeConfiguration="false"/>
      </system.webServer>
      <location path="CaptchaImage.axd">
        <system.web>
          <authorization>
            <allow users="*"/>
          </authorization>
        </system.web>
      </location>
    </configuration>


    Monday, November 22, 2010 10:47 AM
  • User1005758432 posted

    Here's another thing I found out. If I view the page through the "Start Debugging Mode" from within VS2010 then everything works; however, if I view the page through IIS7, regardless if it is my personal test IIS7 or my web host company, it does not work. Any suggestion?


    Monday, November 22, 2010 11:08 AM
  • User1005758432 posted

    I wonder if this line in my web.config has anything to do with the Captcha not showing running it through IIS7.

    <validation validateIntegratedModeConfiguration="false"/>

    Again, it works fine when debugging.


    Monday, November 22, 2010 11:13 AM
  • User1005758432 posted

    Any suggestion? Anybody?

    Tuesday, November 23, 2010 9:43 AM
  • User28957378 posted

    All I had to do was add this for IIS 7 which is different than the local "system.web" config setting:

      <system.webServer>    

              <modules runAllManagedModulesForAllRequests="true" />

              <handlers>       

                      <add name="MSCaptcha" type="MSCaptcha.CaptchaImageHandler" verb="*" path="CaptchaImage.axd"/>    

              </handlers>  

         </system.webServer>

     

    Friday, June 22, 2012 5:13 PM
  • User-974181769 posted

    I had the same issue and changed my Web.Config to this...

    <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.captchaImageHandler, MSCaptcha" />

    Seems to work for me.

    Wednesday, November 27, 2013 6:30 PM
  • User-359936451 posted

    Read this link to get a better understanding about .axd files. They are not files that you can see in the folder. 

    https://stackoverflow.com/questions/3318092/what-is-webresource-axd

    Wednesday, June 7, 2017 7:06 PM