Skip to main content

Insert an image by URL in an ASP.NET Core rich text editor

The Insert Image dialog with Upload, By URL, Drag and Drop and Image Gallery

Sometimes the picture is already online, and uploading it again is unnecessary. The Insert Image button, insertimage, has a By URL tab. It is in every toolbar preset.

Add it

<richtextbox name="Body"
             toolbar="{insertimage,bold,italic}|{undo,redo}"
             height="300px"></richtextbox>

The dialog offers Upload, By URL, Drag & Drop and Image Gallery. Paste the address on the By URL tab and insert.

Describe the picture

Alt text is what a screen reader says and what search engines read. Encourage people to fill it in. The editor's accessibility checker reports pictures without it.

The picture stays on the other site

The address is saved as it is, and the picture is not copied to your server. So:

For content that has to last, upload the picture to your own storage instead.

What is checked on the server

A URL is only text, so the upload checks do not apply: the file is never sent to your server. [RichTextHtml] still cleans the saved HTML, so a script address is removed.

Read next