Captcha control does not work with URL routing (ASP.NET 4.0 WebForms)

ASP.NET 4.0 C # WebForms

I have route.Ignore("{resource}.axd/{*pathInfo}"); in my global.asax for ajax to work properly.

The control is "MSCaptcha".

It shows the path in the source file http://localhost:666/Project/CaptchaImage.axd?guid=96f830ee-6fb9-42ad-9ff4-d6484ffdcbe4 , but does not show the "image".

Can I add something to my global.asax file to make the captcha control work? Any suggestions?

+6
source share
2 answers

Looks like you want to ignore your captchaImage.axd at different depths in your virtual folder hierarchy? This will require processing multiple segments using routing, which is not convenient in your case. It would be better to "fix" the location of CaptchaImage.axd on a specific path, ignore this path through routing, and always refer to CaptchaImage.axd in this place.

Details of asp.net routing. http://msdn.microsoft.com/en-us/library/cc668201.aspx

+1
source

You need to configure it to be ignored at different levels, as Kenneth mentioned. In my application, we worked on only one level. However, you can use the following code and set several levels.

 routes.Ignore("{parent}/{sub}/{resource}.axd"); 
+1
source

Source: https://habr.com/ru/post/888522/


All Articles