ImageTagHelper:是针对HTML原生<img>的封装。
使<img>具备hash value,又被称作图像指纹,优点在於当有要坐上传、提交图片档时,
可用hash判断是否为已提交过的图像避免重复提交至Server上。
要有此机制可以多增加该属性的设定
asp-append-version = "true"
新增好ImageController.cs跟相应Index检视
ImageController.cs
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Net5App6.Controllers
{
public class ImageController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
Index检视(无hash)
@{
ViewData["Title"] = "ImageTagHelper example";
}
<img src="~/img/001.jpg" style="width:30%;height:30%" />
Index检视(有hash)
@{
ViewData["Title"] = "ImageTagHelper example";
}
<img src="~/img/001.jpg" style="width:30%;height:30%" asp-append-version="true" />
可以看到该图片後面开始多串hash了
本篇已同步发表至个人部落格
https://coolmandiary.blogspot.com/2021/08/net-core23imagetaghelper.html
<<: day8 kotlin coroutine的 runBlocking, withContext
>>: [2021铁人赛 Day08] General Skills 05
某一天我们提到,主要的逻辑都写在 django_chatbot/views.py。 但是里面牵涉太多...
5. CakePHP 4.x 打算先用php为底一步一步把cakephp装上 docker pull...
What is function? Simple explanation: when you fin...
题目来源 #include <stdio.h> #include <stdlib....
冷站点没有适当的计算机设备,因此它不提供异地数据存储、保留替代计算能力或响应电子发现请求。 冷站点是...