I have got the requirement to migrate our existing MVC application to asp.net core MVC application.
In MVC application i used session to traverse the data from one controller to another, Now we have plan to move the application to Azure Cloud using Container Registry.
Since i have started it from scratch, I need to use some other approach instead using Session, So In Cloud there should not found any issue when traverse the data.
I need here your best suggestion, Instead using session what other approach should use to achieve the same.
if you're going for Azure App Services (websites) you can set it up that a new request from a user goes back to the same server (assuming you have set up multiple in Azure of course for load balancing your application). So in the beginning you could keep
on making use of session state.
For Azure you could make use of azure storage, cosmosdb or azure cache for redis instead of session state (make a choice not only over tech but also cost!).
On the other hand: why session state? A popular approach is setting up a SPA application with Web api in the background or setting up a SPA and making use of Azure Functions. Recently Azure jamstack was announced. The SPA doesn't have to be with JavaScript
however as you could also check out Blazor (I'm currently creating such an application at my client).
Kris
Read my blog | Twitter Working with Azure, chatbots, ASP.NET MVC, Web API, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Thank you for your suggestion. I just wanted to know few things about session which is below:
Azure Container registry or Azure (PAAS) : accept session? Since i was using session to validate User authentication, Also to move data from one controller to another or Controller to view.
If it not accept Session, Then can i use Token for user authentication and then for carry data, Can use TempData['Temp'] from controller to another.
Or What could be your best approach in above case to implement?
Usually you can configure that (and it is enabled by default for Azure web sites, not sure for containers, you'll use AKS ?). Also I usually use session aonly for few frequently used short stuff that I can load again as needed so that I don't care about
session expiration.
Not sure about your design. You replaced an authentication cookie entirely with a session value or what is exactly the purpose of this value ? (rather an anti forgery token ?)
Thank you for your suggestion. I just wanted to know few things about session which is below:
Azure Container registry or Azure (PAAS) : accept session? Since i was using session to validate User authentication, Also to move data from one controller to another or Controller to view.
If it not accept Session, Then can i use Token for user authentication and then for carry data, Can use TempData['Temp'] from controller to another.
Or What could be your best approach in above case to implement?
Thanks
session is just a library. you can include it in a docker image. you will need to add the code, and configuration.
not sure what session has to do with user validation. session is for storing state between requests. its typically a persistent store, with the key stored in a cookie.
the default implementation of TempData is to store the actual value in a cookie and not use a persistent store.
again this is just code in the application, and does not depend on hosting services, other than support to write host headers (cookie) and access a data store.
Member
57 Points
519 Posts
Instead using Session what could be other approach which should be compatible when release asp.ne...
Jul 14, 2020 02:34 PM|vicky1|LINK
HI All,
I have got the requirement to migrate our existing MVC application to asp.net core MVC application.
In MVC application i used session to traverse the data from one controller to another, Now we have plan to move the application to Azure Cloud using Container Registry.
Since i have started it from scratch, I need to use some other approach instead using Session, So In Cloud there should not found any issue when traverse the data.
I need here your best suggestion, Instead using session what other approach should use to achieve the same.
Kindly suggest.
All-Star
191741 Points
20952 Posts
ASPInsiders
Moderator
MVP
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 14, 2020 03:59 PM|XIII|LINK
Hi,
if you're going for Azure App Services (websites) you can set it up that a new request from a user goes back to the same server (assuming you have set up multiple in Azure of course for load balancing your application). So in the beginning you could keep on making use of session state.
For Azure you could make use of azure storage, cosmosdb or azure cache for redis instead of session state (make a choice not only over tech but also cost!).
On the other hand: why session state? A popular approach is setting up a SPA application with Web api in the background or setting up a SPA and making use of Azure Functions. Recently Azure jamstack was announced. The SPA doesn't have to be with JavaScript however as you could also check out Blazor (I'm currently creating such an application at my client).
Kris
Working with Azure, chatbots, ASP.NET MVC, Web API, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
All-Star
58124 Points
15639 Posts
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 15, 2020 02:06 AM|bruce (sqlwork.com)|LINK
What’s wrong with session? Asp.net core uses a non-blocking async session. Could use redis, or azure sql. Could use table store, lots of options.
Member
57 Points
519 Posts
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 15, 2020 08:04 AM|vicky1|LINK
Hi Bruce,
Thank you for your suggestion. I just wanted to know few things about session which is below:
Thanks
Member
57 Points
519 Posts
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 22, 2020 12:34 PM|vicky1|LINK
Hi All,
Any update on above asked? Still waiting for your answer.
All-Star
48490 Points
18070 Posts
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 22, 2020 12:53 PM|PatriceSc|LINK
Hi,
Usually you can configure that (and it is enabled by default for Azure web sites, not sure for containers, you'll use AKS ?). Also I usually use session aonly for few frequently used short stuff that I can load again as needed so that I don't care about session expiration.
Not sure about your design. You replaced an authentication cookie entirely with a session value or what is exactly the purpose of this value ? (rather an anti forgery token ?)
All-Star
58124 Points
15639 Posts
Re: Instead using Session what could be other approach which should be compatible when release as...
Jul 22, 2020 04:05 PM|bruce (sqlwork.com)|LINK
session is just a library. you can include it in a docker image. you will need to add the code, and configuration.
not sure what session has to do with user validation. session is for storing state between requests. its typically a persistent store, with the key stored in a cookie.
the default implementation of TempData is to store the actual value in a cookie and not use a persistent store.
again this is just code in the application, and does not depend on hosting services, other than support to write host headers (cookie) and access a data store.