2017-09-26 10 views
0

초기 개발시 오류가 있습니다.Sitecore.NET 8.1 (rev. 151003)의 reCAPTCHA V2 오류

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");