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

Gani_tpt 1,526 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

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,261 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,730 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,260 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 25,556 Reputation points Microsoft Vendor
    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) 56,286 Reputation points
    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 40,816 Reputation points
    2024-04-15T16:27:26.2966667+00:00
    0 comments No comments