Skip to content

Commit ecec3fe

Browse files
Fix System.MethodAccessException: Attempt by security transparent method at GeneXus.Utils.GxRestService.WebException.
1 parent e002e7e commit ecec3fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dotnet/src/dotnetframework/GxClasses/Services/GXRestServices.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public void WebException(Exception ex)
392392
{
393393
throw ex;
394394
}
395-
else if (ex is FormatException || ex is HttpAntiForgeryException)
395+
else if (ex is FormatException || (RestAPIHelpers.ValidateCsrfToken() && AntiForgeryException(ex)))
396396
{
397397
HttpHelper.SetUnexpectedError(httpContext, HttpStatusCode.BadRequest, ex);
398398
}
@@ -401,6 +401,12 @@ public void WebException(Exception ex)
401401
HttpHelper.SetUnexpectedError(httpContext, HttpStatusCode.InternalServerError, ex);
402402
}
403403
}
404+
[SecuritySafeCritical]
405+
private bool AntiForgeryException(Exception ex)
406+
{
407+
return ex is HttpAntiForgeryException;
408+
}
409+
404410
public bool IsAuthenticated(string synchronizer)
405411
{
406412
GXLogging.Debug(log, "IsMainAuthenticated synchronizer:" + synchronizer);

0 commit comments

Comments
 (0)