what is the best way to store documents in asp.net application

BeUnique 2,332 Reputation points
2024-04-15T12:28:39.9233333+00:00

I am developing asp.net application. i want to store documents some where in the file server folder or in the database.

if i use binary option in sql server table for storing the documents,

Is it good way to manage file in SQL server..?

or shall i use directly placed soft copy of the file in file server path...?

pls. advice

Developer technologies | ASP.NET | Other
SQL Server | Other
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 30,191 Reputation points Microsoft External Staff
    2024-04-16T02:55:11.3066667+00:00

    Hi @Gani_tpt,

    It mostly depends on the size of your files.

    • If your documents are typically less than 256K in size, it would be more efficient to store them in a database VARBINARY column.
    • if your documents are typically over 1 MB in size, storing them in the filesystem is more efficient (and with SQL Server 2008's FILESTREAM attribute, they're still under transactional control and part of the database)

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2024-04-15T15:42:26.8533333+00:00

    depends on your requirements.

    sqlserver has good document support, can store files externally, can be exposed as a file share, full text indexing support, backup.

    the most common alternative is a cloud based table store (azure blobs, AWS S3).

    0 comments No comments

  2. Olaf Helper 47,441 Reputation points
    2024-04-15T16:27:26.2966667+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.