我正在创建一个Base64 png图像(一个二维码),但它不会显示(MVC项目)。我只是在页面上打印HTML代码。我已经使用在线Base64图像查看器验证了图像是否正确显示。
这是观看代码:
<div class="widget-body">
<div class="topUpBlock">
<p style="text-align: left"> Click to create a QR code that can be scanned to buy a meal. </p>
<a href="@Url.Action("CreateMealStub", "Home", new {cardId = card.CardId})">
<span class="btn btn-primary pull-right">Generate</span>
</a>
</div>
@Model.MealStubImage
</div>
Model.MealStub包含以下字符串:
<img src="data:image/png; base64,iVBORw0KGgoAAAANSUhEUgAAAzQAAAM0CAYAAABtcmd3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAGpmSURBVHhe7ddRiiQ5AAPRuf+ldy8QCdlIUEo7HsS3jNM1Q//7T5IkSZI+yj9oJEmSJH2Wf9BIkiRJ+iz/oJEkSZL0Wf5BI0mSJOmz/INGkiRJ0mf5B40kSZKkz/IPGkmSJEmf5R80kiRJkj7LP2gkSZIkfZZ/0EiSJEn6LP+gkSRJkvRZ/kEjSZIk6bP8g0aSJEnSZ/kHjSRJkqTP8g8aSZIkSZ/lHzSSJEmSPss/aCRJkiR9ln/QSJIkSfos/6CRJEmS9Fn+QSNJkiTps/yDRpIkSdJn+QeNJEmSpM/yDxpJkiRJn+UfNJIkSZI+yz9oJEmSJH2Wf9BIkiRJ+iz/oJEkSZL0Wf5BI0mSJOmz/INGkiRJ0mf5B40kSZKkz/IPGkmSJEmf5R80kiRJkj7LP2gkSZIkfZZ/0EiSJEn6LP+gkSRJkvRZ/kEjSZIk6bP8g0aSJEnSZ/kHjSRJkqTP8g8aSZIkSZ/lHzSSJEmSPss/aCRJkiR9ln/QSJIkSfos/6CRJEmS9Fn+QSNJkiTps/yDRpIkSdJn+QeNJEmSpM/yDxpJkiRJn+UfNJIkSZI+yz9oJEmSJH2Wf9BIkiRJ+iz/oJEkSZL0Wf5BI0mSJOmz/INGkiRJ0mf5B... [NOTE: HAD TO LIMIT THIS, TOO LARGE TO POST] ...ZYAAAAAElFTkSuQmCC" />
最后,这是呈现的内容:
我错过了什么?