ispiro
ispiro

Reputation: 27673

How do I make files hidden when deploying an ASP.net project? (Or not upload them at all.)

I have some text files (and others) that I want to be hidden from the public when deploying an ASP.net project. How do I do that? (And what's the technical term for that? "hidden"? Searching, I couldn't find an answer to this so I'm probably using the wrong term.)

Also, if you know of a way to specify not to upload certain files when publishing - I'd like to hear it. (I know I can do that by excluding them from the project, but I rather they stay included because I use them while debugging on localhost.)

Upvotes: 1

Views: 1111

Answers (2)

Caspar Kleijne
Caspar Kleijne

Reputation: 21864

You can put them in the App_Data folder in your project that is available on the webserver via the file system or your application but not accessible from the internets.

Upvotes: 2

tostringtheory
tostringtheory

Reputation: 877

I suppose if you want the files to be included, but not reachable via web request, you could look at the IIS redirect module. As for not uploading a file at all, simply select the item in the solution explorer, right-click and select properties (or press F4), and change the build action to none. Files should only be included in a deployment if you choose content.

Upvotes: 2

Related Questions