asp.net - Recaptcha - Invalid Operation Exception: Http request context does not exist -


well, recaptcha used twice on site (both in process of registration). first time works perfect, second got exception above (when getcaptchaverificatoinhelper method called). also: first time recaptcha located in form (page) loaded synchronously, second time recaptcha located in partialview, updated via ajax. how fix this? also, nice if gave me reasons happening. in advance.

this problem method:

public task<actionresult> sendsmsagain(captchastubviewmodel viewmodel)     {         viewmodel.notificationmessage = null;         return task<actionresult>.factory.startnew(() =>         {             if (!httpcontext.request.isajaxrequest())                 return null;   var val = webconfigurationmanager.appsettings["recaptchaprivatekey"];  recaptchaverificationhelper helper = this.getrecaptchaverificationhelper(val);   viewmodel.captchavalue = helper.response;  if (string.isnullorempty(helper.response))   { modelstate.addmodelerror("captchavalue", "you should insert captcha value sms");}...} 

update
has rewritten logic without ajax verification, doesn't still work.
btw: second captcha used after redirection. can me? still same error.

according recaptcha.codeplex, recaptcha hasn't supported verification through ajax yet.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -