开发者

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

开发者_JAVA技巧.........

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


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


How about:

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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜