1

I want to upload a file through asp.net mvc and delete the file after the session is destroyed ?

tereško
  • 58,060
  • 25
  • 98
  • 150
mahesh
  • 251
  • 2
  • 4
  • 6

3 Answers3

0

Check out this link which has code in c#. This will tell you how to find a file and delete it, but you must handle checking for session and associated logic. Link

The Muffin Man
  • 19,585
  • 30
  • 119
  • 191
0

You can try Session_End in global.asax however the latter is very predictable. If I were you I would delete the temporary files after a certain amount of time e.g. I will delete all files which are one day old.

Community
  • 1
  • 1
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
0

if i were to do the same thing in java.. i will write a session listener and fireup deleting files on session invalidation...

check whether same kind of thing exists in ASP.NET ..