No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
With MVC, we have a controller GetImage that expects an object identity and an attribute with a Blob, like this: | With MVC, we have a controller <code>GetImage</code> that expects an object identity and an attribute with a Blob, like this: http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage | ||
You may append yet another section with '-' that denotes a content-type header to send to the browser: | You may append yet another section with <code>'-'</code> that denotes a content-type header to send to the browser: | ||
http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage-application%2Fpdf will use application/pdf as the content | http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage-application%2Fpdf will use application/pdf as the content type. | ||
This controller may be used by Angular views as well if you want to construct a link to download a file or something without actually having the attribute loaded (if it is marked as delayed fetch). | This controller may be used by Angular views as well if you want to construct a link to download a file or something without actually having the attribute loaded (if it is marked as delayed fetch). | ||
Line 11: | Line 11: | ||
==== Option 2 ==== | ==== Option 2 ==== | ||
For security concerns, use the AllowMVCAccess tagged value on the attribute | For security concerns, use the <code>AllowMVCAccess</code> tagged value on the attribute. This is the default "ok" for byte[] (to be backward compatible) and the default "notok" for strings - you can also set "okwhenauthenticated". No accessgroup evaluation is provided for GetImage. | ||
See also [[The_ExternalId_explained]] to create a more long-lived link. | See also [[The_ExternalId_explained]] to create a more long-lived link. | ||
[[Category:MVC]] | [[Category:MVC]] |
Revision as of 07:41, 7 June 2023
With MVC, we have a controller GetImage
that expects an object identity and an attribute with a Blob, like this: http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage
You may append yet another section with '-'
that denotes a content-type header to send to the browser:
http://localhost:5052/Turnkey/GetImage?img=9!10-SomeImage-application%2Fpdf will use application/pdf as the content type.
This controller may be used by Angular views as well if you want to construct a link to download a file or something without actually having the attribute loaded (if it is marked as delayed fetch).
Option 1
Now you can return Text content this way too.
Option 2
For security concerns, use the AllowMVCAccess
tagged value on the attribute. This is the default "ok" for byte[] (to be backward compatible) and the default "notok" for strings - you can also set "okwhenauthenticated". No accessgroup evaluation is provided for GetImage.
See also The_ExternalId_explained to create a more long-lived link.