Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was wondering if there are any ways of creating middleware for asp.net mvc websites?

What I have tried:

I haven't found any tutorials/questions on this online. Kindly share any links that might help
Posted
Updated 24-Aug-21 6:49am
Comments
Richard MacCutchan 24-Aug-21 11:35am    
What do you mean by "middleware"?

1 solution

Yes, although it seems the documentation is intimately linked with adding ASP.NET Identity to your site.

Adding ASP.NET Identity to an Empty or Existing Web Forms Project - ASP.NET 4.x | Microsoft Docs[^]
Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application - Rick Strahl's Web Log[^]

The key part you're looking for is OWIN. You'll need to add the Microsoft.Owin.Host.SystemWeb package, and add a Startup class to configure your OWIN pipeline.
C#
using System;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(YourNamespace.Startup))]

namespace YourNamespace
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ...
        }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900