Question

I converted my MVC 3 project from to aspx to razor, having a problem with this line: ASPX:

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

Razor:

@{
Register TagPrefix="cc1" Namespace="WebControlCaptcha" Assembly="WebControlCaptcha";
} 

Here is the error:

Compiler Error Message: CS1002: ; expected

Thanks in advance.

Was it helpful?

Solution

You can put, in the web.config inside Views folder, the following key:

<configuration>

  <system.web>
    <pages>
      <controls>
        <add assembly="WebControlCaptcha" namespace="WebControlCaptcha" tagPrefix="cc1" />
      </controls>
    </pages>
  </system.web>

</configuration>

OTHER TIPS

In my case, the application pool was set to use integrated pipeline mode with .NET Framework 2.0. The CAPTCHA image would not generate. I changed the application pool to use "Classic" while leaving the .NET Framework option the same and this fixed the image generation issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top