Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Captcha control not working 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 my ajax to work correctly.

The control is a "MSCaptcha".

It shows the path in sourcefile 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 to get the captcha control to work? Any suggestions?

like image 310
Kasper Skov Avatar asked May 19 '11 10:05

Kasper Skov


2 Answers

It looks like you want to be able to ignore your captchaImage.axd at different depths in your virtual folder hierarchy? This would require handling multiple segments via routing which isn't convenient in your case. It would be better to "fix" the location of the CaptchaImage.axd to a certain path, ignore that path via routing, and always reference the CaptchaImage.axd at that one location.

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

like image 103
Kenneth Ito Avatar answered Nov 09 '22 09:11

Kenneth Ito


You do need to set it to ignore at the different levels as mentioned by Kenneth. In my app, we only dealt with one level deep. However, you can use the following code and set multiple levels.

routes.Ignore("{parent}/{sub}/{resource}.axd");
like image 22
Ricketts Avatar answered Nov 09 '22 10:11

Ricketts