How to create ASP.Net Core Cookie on first request

428 Views Asked by At

We've ported a large web application to .Net 6. We have everything working, but we're working on cleaning up the code.

In .Net Framework, we created a session cookie on the first request in the session using the IsNewSession method on HttpSessionState in a HttpModule.

In .Net 6, we need to store a cookie on the first request to achieve the same functionality. We have managed to create a cookie that works in the same way, but we haven't found the correct place to put it. For now we have put it in a DynamicRoutingValueTransformer.

Where and how can we create a cookie in the first request in a visit in the correct way in .Net 6?

0

There are 0 best solutions below