Hi in mvc5 i have a NotificationHandler.ashx handler and i make something
if (context.Request.HttpMethod == "POST") { i get a json context and do something.... }
and the url is https://mysite/HttpHandler/NotificationHandler.ashx
how do i make exactly the same in a Middleware handler in .net core ? My proble is the url in mvc5 i made ashx (it is url) in .net core how can
do that ?
public class NotificationHandler { private readonly RequestDelegate _next;public NotificationHandler(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext httpContext) { if (httpContext.Request.Method == "POST"){ //do something.....i get json here } return _next(httpContext); } } // Extension method used to add the middleware to the HTTP request pipeline. public static class NotificationHandlerExtensions { public static IApplicationBuilder UseNotificationHandler(this IApplicationBuilder builder) { return builder.UseMiddleware<NotificationHandler>(); } }
I am confused because i need a url to send me cloud services json