Temporatry File Name

T

Thom Little

I have just finished an ASP.NET application that needs one (the last)
remaining tweak. It writes two temporary files and then appends them to an
SMTP message.

ASP 3 had a function ...
GetTempName
.... to generate unique temporary filenames. Is there an easy standard way
to generate temporary file names in ASP.NET?
 
M

[MSFT]

Hello Thom,

There is no such a function in ASP.NET or .NET framework. I think we have
two options here:

1. Use COM interop and stick on GetTempName.
2. Use Random Class in .NET to generate random value and compose random
string.

Hope this help,

Luke
 
T

Thom Little

The answer for me was ...

string strNameXLS = Path.ChangeExtension ( Path.GetTempFileName( ),
"xls" );
StreamWriter swXLS = File.CreateText( strNameXLS );

Thank you both for helping me with the "final tweak".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top