I have controller with 2 methods. First method should set variable and do something. Second method (called by ajax) should get value of this variable. So, I can't use TempData and Cache (because there are 2 different requests). How to solve it? Use Session? But session is disabled by default in asp.net mvc and I'm afraid to have unexpected behavior of the whole application if I enable it... Global variables are not approved too (because I need to get value of variable for concrete user)
EDIT: workflow is:
- client jquery script call Upload method controller and pass a huge file. This method is executing long time (i.e. 1 minute, no matter). This method generates the unique name of file and add record to DB (with this unique name)
- user can cancel uploading and click 'cancel'. It calls another server method (i.e. named Cancel), which should remove record from DB (added by Upload method) and remove uploaded file (or uploaded part of this file).
So, in Cancel method I need to know the unique name of file, which is being uploaded. I have to store this name in Upload method in any storage (i.e. Redis, DB etc) and remove from this storage after upload success (or in Cancel method, if Cancel was called)