L
L
Lepricon742021-03-21 15:30:33
SQL
Lepricon74, 2021-03-21 15:30:33

How to properly store and display text with images in HTML in ASP.NET Core?

Good afternoon! There is a server (ASP.NET Core) that should, upon request, return a rendered HTML page containing text with images (articles on various topics). How to organize the storage and sending of such information?

So far, I see only 2 options:
1) Store the finished html files on the server in a separate folder and simply return them depending on the received parameters. In my opinion, this method looks doubtful if you need to store hundreds of such files.
2) Store all the information in the database, get it in the controller and dynamically build pages in the View. But in this case, it is not entirely clear how to store information about paragraphs, selections, lists, and the location of images, because in this case all text will be stored in 1 line. Also, with this approach, there is a problem of parsing this huge string when forming html in the View.

I would like to know how true the above options are, what are the alternatives? How to organize this functionality?

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2021-03-22
@yarosroman

In principle, you can store ready-made html and then display it immediately on the page, you don’t need to parse anything, just cut out unnecessary tags before adding it to the database.
You can use Markdown markup https://github.com/RickStrahl/Westwind.AspNetCore....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question