Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting HttpModule .Net Class Library to .Net Core Web API

I am migrating a project from .net Web Application to .Net core Web API.

I am using HTTP Module which is .net framework class library, in IIS Integrated mode.

So, thought to port as it is, to my new core app.

I pasted web.config to my new core app and added a project reference to that Http Module and it started working.

I am having some Context.Response.Write in my BeginRequest method, and I can see those lines whenever I am making a call to my web api.

But, I am having some questions here.

  1. No break point is hitting in the module.
  2. I thought no symbols were loaded, so I looked into the Modules window in VS but no such module is loaded.
  3. Any way to load the symbols when the non core projects loaded into core projects.
  4. Wondering how, without loading a reference, the module is invoking.

Could some one share some inputs on above points.

Thx.

like image 777
NANDAKUMAR THANGAVELU Avatar asked Jan 29 '23 10:01

NANDAKUMAR THANGAVELU


1 Answers

ASP.NET Core has no support for HTTP modules, the pipeline has been completely redesigned. It's only being invokved because you told IIS to run it, but it won't have any visibility as far as your application is concerned (IIS is "external" to your application in the Core world).

Microsoft has some decent documentation around converting to the new middleware system here (far too much to re-post or condense into an answer):

https://learn.microsoft.com/en-us/aspnet/core/migration/http-modules

like image 172
McGuireV10 Avatar answered Feb 01 '23 18:02

McGuireV10