Skip to content

Instantly share code, notes, and snippets.

View ktownsend-personal's full-sized avatar

Keith Townsend ktownsend-personal

  • 01:06 (UTC -05:00)
View GitHub Profile
@ktownsend-personal
ktownsend-personal / (aspNet MVC 5 use classicASP session).md
Last active January 13, 2024 05:46
How to synchronize classicASP session with ASP.NET MVC 5

How to synchronize classicASP session with ASP.NET MVC 5

This is related to a gist I wrote for doing this with ASP.NET Core 8, which was a refactor based on this code. I'm just dumping the old code here for reference. Read that gist for full description of the strategy and challenges I had to overcome.

This older version is using ActionFilter on the MVC 5 side of things to coordinate sync and puts a class holding the data and helper methods in the controller's ViewBag with a handy extension method to access it. The new refactor for ASP.NET Core 8 is using a scoped service class you can inject where you need it.

The classicASP side is virtually the same in both versions aside from a few tweaks I did in the newer version to drop an unnecessary HTTP verb and improve sync of removed variables.

If you end up using any of this, my only ask is that you link to this gist and give me some credit in your code for the next developer t

@ktownsend-personal
ktownsend-personal / (aspNetCore use classicASP session).md
Last active January 13, 2024 06:40
How to synchronize classicASP session with ASP.NET Core 8

How to synchronize classicASP session with ASP.NET Core 8

This is related to my other gist where I use both ASP.NET Core 8 and classic ASP in the same website. You'll probably want to read that too if you're needing to do what I describe in this gist.

My original version of this was for MVC 5 several years ago. I have a separate gist of the MVC 5 version here. It worked so well I decided to refactor it for a new project I'm working on.

The code in this gist is fresh out of the oven. Everything I set out to do is working well, but not in production yet so there could be some edge cases I missed. Let me know if you run into something.

I dramatically changed the C# side of it for this new version because the coding strategy differs so dramatically between MVC 5 and ASP.NET Core 8. The classicASP side of it is mostly the same as the prior version asi

@ktownsend-personal
ktownsend-personal / (aspNetCore + classicASP).md
Last active January 19, 2024 18:31
How to host classic ASP with your ASP.NET Core project

Host classic ASP in an ASP.NET Core 8 project

I have a situation where I need to migrate a very old classic ASP website gradually into an ASP.NET Core 8 website.

In my research I found many people asking how but never found a fully working example, so I want to share this for others.

If you end up using any of this, my only ask is that you link to this gist and give me some credit in your code for the next developer to discover... and of course tell me about how it saved your life in the gist comments ☺

Solution Summary:

  • add ISAPI handler in web.config for each file extension to process as classicASP
  • put classicASP files in wwwroot folder of your aspNetCore project