System.NotSupportedException: Specified method is not supported. at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.set_Position(Int64 value) at webapi.baseframework.auth.GlobalSQLInjectCheckMiddleware.InvokeAsync(HttpContext context) in GlobalSQLInjectCheckMiddleware.cs:line 67 at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
1 2 3 4 5 6 7 8 9
if (context.Request.Method == HttpMethods.Post && context.Request.ContentType?.StartsWith("application/json") == true) { using (var reader = new StreamReader(context.Request.Body)) { var json = await reader.ReadToEndAsync(); context.Request.Body.Position = 0; } }