1

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

tereško
  • 57,247
  • 24
  • 95
  • 149
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
  • 18,855
  • 30
  • 113
  • 189
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,432
  • 8
  • 57
  • 92
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 ..