开发者

In a ASP.NET program is there a location where I can I write temporary files?

In a ASP.NET program is there a location where I can I write temporary files? Assuming a default IIS instal开发者_JAVA技巧lation, the program running under anonymous user?

Thank you


You can pretty much save temporary files anywhere on disk as long as you have permissions. You will just need to make sure the files are uniquely named per anonymous user.

Ideally having a dedicated "temporary" folder is a good idea, where these files will be deleted or cleaned up periodically.


You could (and probably should) use System.IO.Path.GetTempPath(). If you want .NET to take care of generating a uniquely named random, temporary file then use the GetTempFileName() method also in System.IO.Path


No there's no such built-in mechanism available for asp.net

What you can do is create the one witihn your application root and use it for temp operations like this.

string tempPath = Server.MapPath("~\\temp");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜