When should the received files be temporarily deleted on the client's computer?

Mojtaba_Hakim 321 Reputation points
2022-10-16T12:58:53.727+00:00

I am in a C# WPF project
I have a program that receives the file stored in binary form in SQL Server and puts it in a folder in the TEMP path.
For example: there is a photo in the database, I select it and writeAllBytes in the temp, then using Process.Start(C:\temp.myiamge.png) I run that photo through the Windows Photo Viewer.

What I need:
I don't know how and when I can check to delete the file I wrote in the temp path after closing the Windows Photo Viewer window?

Does anyone have any recommendations?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,799 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,153 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,117 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
821 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 45,366 Reputation points
    2022-10-17T05:48:24.397+00:00

    I don't know how and when I can check to delete the file I wrote in the temp path after closing the Windows Photo Viewer window?

    If you don't know that how should we?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.