Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Microsoft Silverlight for Windows Phone
Tech blogger
Microsoft Technical Community Speaker
 Handling request in WebApi
 Introducing lightweight ASP.NET Core
A new open-source and cross-platform framework for building modern
cloud-based Web applications using .NET
Choose your Editors
and Tools
Open Source
with Contributions Cross-PlatformOSS
Seamless transition
from on-premises to clo...
How will you -
• Modify request headers ?
• Add a response header to responses ?
• Validate requests before they reach the...
1. HttpServer
2. HttpRoutingDispatcher
3. HttpControllerDispatcher
Three simple steps :
1. Inherit from DelegatingHandler
2. Override the send async method
3. Put it on the pipeline(Registe...
public class MessageHandler1 : DelegatingHandler
{
protected async override Task<HttpResponseMessage>
SendAsync(HttpReques...
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MessageHandlers.Add(new ...
ResponseRequest Middleware
Facebook
Personal Blog
LinkedIn
http://LearnWithShahriar.wordpress.com
Thank You
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Middleware in Asp.Net Core
Upcoming SlideShare
Loading in …5
×

Middleware in Asp.Net Core

865 views

Published on

In this slide, i cover what Middleware is, how we used to handle middleware stuffs in WebApi etc

Published in: Technology
  • Be the first to comment

Middleware in Asp.Net Core

  1. 1. Microsoft Silverlight for Windows Phone Tech blogger Microsoft Technical Community Speaker
  2. 2.  Handling request in WebApi  Introducing lightweight ASP.NET Core
  3. 3. A new open-source and cross-platform framework for building modern cloud-based Web applications using .NET
  4. 4. Choose your Editors and Tools Open Source with Contributions Cross-PlatformOSS Seamless transition from on-premises to cloud Faster Development CycleTotally Modular Fast
  5. 5. How will you - • Modify request headers ? • Add a response header to responses ? • Validate requests before they reach the controller ? • Log the incoming requests and the outgoing responses ?
  6. 6. 1. HttpServer 2. HttpRoutingDispatcher 3. HttpControllerDispatcher
  7. 7. Three simple steps : 1. Inherit from DelegatingHandler 2. Override the send async method 3. Put it on the pipeline(Register your handler)
  8. 8. public class MessageHandler1 : DelegatingHandler { protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(“Inside MessageHandler1") }; var tsc = new TaskCompletionSource<HttpResponseMessage>(); tsc.SetResult(response); return await tsc.Task; } }
  9. 9. public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.MessageHandlers.Add(new MessageHandler1()); // Code Excerpt } }
  10. 10. ResponseRequest Middleware
  11. 11. Facebook Personal Blog LinkedIn http://LearnWithShahriar.wordpress.com
  12. 12. Thank You

×