Write to CSV file and export it?

后端 未结 6 611
悲哀的现实
悲哀的现实 2020-11-30 01:58

In C# ASP.net, could someone show me how I can write entries from an Array/List to a CSV file on the server and then open the file? I think the second part would be somethin

6条回答
  •  野性不改
    2020-11-30 02:48

    How to write to a file (easy search in Google) ... 1st Search Result

    As far as creation of the file each time a user accesses the page ... each access will act on it's own behalf. You business case will dictate the behavior.

    Case 1 - same file but does not change (this type of case can have multiple ways of being defined)

    • You would have logic that created the file when needed and only access the file if generation is not needed.

    Case 2 - each user needs to generate their own file

    • You would decide how you identify each user, create a file for each user and access the file they are supposed to see ... this can easily merge with Case 1. Then you delete the file after serving the content or not if it requires persistence.

    Case 3 - same file but generation required for each access

    • Use Case 2, this will cause a generation each time but clean up once accessed.

提交回复
热议问题