Nagelfar
Nagelfar

Reputation: 813

ASP.NET Website where to save generated files

I have a ASP.Net website and in some cases it's generating .pdf-files and .csv files for users to download.

Now my question: What is the default directory for saving that files on the webserver? Is there any ASP.NET Folder like App_... or something like that?

What can you recommend?

Upvotes: 0

Views: 1390

Answers (5)

Ben
Ben

Reputation: 423

It is also important that you consider whether you are going to have more than one web server, and have servers in a cluster. To be ready for such a case, it is better not to keep the files under the web application folder, and not to access them relatively to the application path, but keep the files in a separate folder that you could easily expose (there will still be security issues) as a network path.

Upvotes: 0

PHeiberg
PHeiberg

Reputation: 29811

If you don't want to reuse the files, stream the files directly without saving it to disk.

If you save it to disk you have to ask yourself if the content of the file is to be available to all users or if it's a bad idea that other users can access the files. If it's a bad idea, the folder you put the files in should be made unavailable to the users by setting access rights correspondingly. You can either do this by putting the folder outside of the web site directory or by setting security settings in the file system or on the web server.

You can basically put the files in any folder that is made writable for the user writing the file (typically the ASP.NET App Pool user). IIRC the App_data folder is writable by default for the ASP.NET user, so that could be a candidate.

Upvotes: 3

Neil Wood
Neil Wood

Reputation: 153

Folder is anything you tell it to be. If you have low volume you could just stream the files from memory so they're not stored on the server.

Upvotes: 1

Oliver Gray
Oliver Gray

Reputation: 874

It's really up to you! I would recommend you put them in a sub folder of your solution so that they are self contained and you can easily control security without worrying about folders further down the tree.

Upvotes: 1

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28970

You can create your proper folder for this need

Here list of specific Folder (But you don't need):

App_GlobalResources, 
App_LocalResources, 
App_Resources
App_Themes
App_WebReferences)
App_Code
App_Data
App_Browsers

Here MSDN link about project structure

Link : http://msdn.microsoft.com/en-us/library/ex526337%28v=vs.100%29.aspx

Upvotes: 1

Related Questions