简体   繁体   English

Captcha控件不使用url-routing(ASP.NET 4.0 WebForms)

[英]Captcha control not working with url-routing (ASP.NET 4.0 WebForms)

ASP.NET 4.0 C# WebForms ASP.NET 4.0 C#WebForms

I have route.Ignore("{resource}.axd/{*pathInfo}"); 我有route.Ignore("{resource}.axd/{*pathInfo}"); in my global.asax for my ajax to work correctly. 在我的global.asax中,我的ajax正常工作。

The control is a "MSCaptcha". 该控件是“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". 它显示源文件http://localhost:666/Project/CaptchaImage.axd?guid=96f830ee-6fb9-42ad-9ff4-d6484ffdcbe4但不显示“图像”。

Can I add something to my global.asax to get the captcha control to work? 我可以在我的global.asax中添加一些东西来使captcha控件工作吗? Any suggestions? 有什么建议?

You do need to set it to ignore at the different levels as mentioned by Kenneth. 您确实需要将其设置为在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");

It looks like you want to be able to ignore your captchaImage.axd at different depths in your virtual folder hierarchy? 看起来您希望能够忽略虚拟文件夹层次结构中不同深度的captchaImage.axd? 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. 最好将CaptchaImage.axd的位置“修复”到某个路径,通过路由忽略该路径,并始终在该位置引用CaptchaImage.axd。

Details on asp.net routing. 有关asp.net路由的详细信息。 http://msdn.microsoft.com/en-us/library/cc668201.aspx http://msdn.microsoft.com/en-us/library/cc668201.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM