2017-09-26 8 views
0

当初の開発では、以下のエラーが発生しています。ReCAPTCHA V2 in Sitecore.NET 8.1(改訂151003)エラー

私はGoogleにエラーを表示しています。一度フォームを保存しようとしました。

We experienced a technical difficulty while processing your request. 
Your data may not have been correctly saved. 

詳細については添付ファイルをご覧ください。 現在のエラー

Message: The remote server returned an error: (403) Forbidden. 
Source: System at System.Net.WebClient.DownloadDataInternal(Uri 
address, WebRequest& request) at 
System.Net.WebClient.DownloadString(Uri address) at 
Sitecore.Forms.Mvc.Validators.RecaptchaResponseValidatorAttribute.ValidateFieldValue(IViewModel 
model, Object value, ValidationContext validationContext) at 
Sitecore.Forms.Mvc.Validators.DynamicValidationBase.IsValid(Object 
value, ValidationContext validationContext) at 
System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(Object 
value, ValidationContext validationContext) at 
System.Web.Mvc.DataAnnotationsModelValidator.Validate(Object 
container) at 
System.Web.Mvc.ModelValidator.CompositeModelValidator.<Validate>d__1.MoveNext() 
at System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
Sitecore.Forms.Mvc.Controllers.ModelBinders.SectionModelBinder.BindFieldCollection(ControllerContext 
controllerContext, ModelBindingContext bindingContext, IEnumerable`1 
list) at 
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext 
controllerContext, ModelBindingContext bindingContext, 
PropertyDescriptor propertyDescriptor) at 
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext, Object model) 
at 
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext 
controllerContext, ModelBindingContext bindingContext, Type 
elementType) at 
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext 
controllerContext, ModelBindingContext bindingContext, 
PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) 
at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext 
controllerContext, ModelBindingContext bindingContext, 
PropertyDescriptor propertyDescriptor) at 
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext, Object model) 
at 
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
Sitecore.Forms.Mvc.Controllers.ModelBinders.FormModelBinder.BindModel(ControllerContext 
controllerContext, ModelBindingContext bindingContext) at 
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext 
controllerContext, ParameterDescriptor parameterDescriptor) at 
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext 
controllerContext, ActionDescriptor actionDescriptor) at 
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext 
controllerContext, String actionName) 4908 08:35:10 WARN Web Forms 
for Marketers: an exception 'The remote server returned an error: 
(403) Forbidden.' has occured while trying to execute an action ''. 

Console Error

+0

あなたの質問は不明です。問題を再現する方法を明確に記述する必要があります。 – svgrafov

答えて

0

これは、プロキシの問題は次のとおりです。

var response = Request["g-recaptcha-response"]; 
var client = new WebClient(); 
var url = string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response); 
NetworkCredential netcredit = new NetworkCredential("username", "password", "domain"); 
client.Credentials = netcredit; 
WebProxy proxyObject = new WebProxy("proxyurl"); 
proxyObject.Credentials = new System.Net.NetworkCredential("username", "password", "domain"); 
client.Proxy = proxyObject; 
var result = client.DownloadString(url); 
var obj = JObject.Parse(result); 
status = (bool)obj.SelectToken("success");