ozsenegal
ozsenegal

Reputation: 4133

Problem captcha Asp.NET MVC

I have a captcha in my MVC application that is called from a HttpHandler (.ashx).

It works fine in Visual Studio developer server.

I just configure in Global.asax:

        public static void RegisterRoutes(RouteCollection routes)
        {    
            routes.IgnoreRoute("{filename}.ashx/{*pathInfo}");//captcha

.........

It ignores the follow path in Visual Studio developer server:

http://localhost:5011/captcha.ashx?id=2342556fgh767896sa

Problem is now i'm running the application in IIS 7.Now the path to be ignored has changed to:

http://localhost/Sce/captcha.ashx?id=2342556fgh767896sa

And it doesn't work anymore.

Any ideas to ignore the new path?

UPDATE:

I´ve solved my problem.Need to add the handler in web.config,but not in <httpHandler> section.Must be in <system.webserver> section cause im using IIS 7.0

Upvotes: 0

Views: 2082

Answers (2)

Kevin LaBranche
Kevin LaBranche

Reputation: 21078

How about:

routes.IgnoreRoute("{allashx}", new {allashx=@".*\.ashx(/.*)?"});

Order is important. Put this first before your controller routes.

Upvotes: 1

Daniel A. White
Daniel A. White

Reputation: 190897

Add the handler to the system.webserver section of your web.config.

Upvotes: 2

Related Questions