简体   繁体   中英

Classic ASP session to MVC session

Is it possible to set a session in Classic ASP and use it in an MVC project?

I have taken over a project for a company and they have original website in MVC and they the new feature I am adding needs to be in MVC, I am not able to convert the classic ASP to MVC because it would require to much time. So I am looking for a solution where I can set a session in ASP and use it in MVC.

Currently I am setting a session by passing in an ID through a URL to the first MVC page they visit. Which looks like:

<a href="MyMvcPage/1"> MVC Home Page </a>

When I go to the page, I fetch the parameter from the URL and then I create a session, from here I am setting the session in the method "Session_Start()" which is built into MVC. Is there a solution where I can use this method in classic ASP or another method to set a session which I can use in MVC.

If you don´t want to use a database, go for this approach:

http://devproconnections.com/aspnet/share-session-state-between-asp-and-aspnet-apps (scroll down, you don't have to register)

Because the HttpRequest to your MVC pages also includes the ASPSession in the httpheaders, you can use that one to request an asp page with that same session and return session variables. Actually it's based on session hijacking, but in a good way ;-).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM