静态html
return Redirect($"~/Wechat/errorCode.html?msg={HttpUtility.UrlEncode("非法请求!", Encoding.UTF8)}");
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <script src="js/jquery.min.js"></script> <title>陕汽重卡</title> <style> body { background-color: #f3f4f5; padding-top: 80px; } .error-img { 70%; margin: 0 auto; } .error-img img { 100%; } p { text-align: center; color: #333; font-size: 20px; margin-top: 60px; } </style> </head> <body id="errorCode"> <!--错误图标--> <div class="error-img"> <img src="images/error_page.png" alt="" /> </div> <p class="message"></p> <script> //从网址截取防伪码 var getUrlParams = function (urlName) { var reg = new RegExp("(^|&)" + urlName + "=([^&]*)(&|$)"); var r = decodeURI(window.location.search).substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }; //decodeURI(URIstring) var message = getUrlParams('msg'); $(".message").text(decodeURIComponent(message)); </script> </body> </html>
schtml
var msg = verityRes.Msg;
ViewBag.Message = HttpUtility.UrlEncode(verityRes.Msg, Encoding.UTF8);
return View("~/Views/" + Templete + "/vipcenter/CheckFail.cshtml");
@using System.Text @{ Layout = "~/Views/M2/Shared/_VipLayout.cshtml"; ViewBag.Title = "VIP入会提示"; } @section Styles{ <link rel="stylesheet" href="@Url.Content("~/Thems/M2/css2/index.css")"> } <style> body { padding: 1.8rem 0.6rem; min-height: 100vh; box-sizing: border-box; } .errorBox { position: relative; padding: 1.5rem 0.3rem 0.5rem; box-sizing: border-box; background-color: #b6dbdb; border-radius: 0.26rem; font-size: 0.36rem; } .errorBox img { position: absolute; 2rem; top: -1rem; left: 2rem; } .errorBox p { text-align: center; margin: 0; line-height: 1.5; } .back { 100%; height: 0.86rem; font-size: 0.32rem; color: #fff; background-color: #048791; border: none; outline: none; border-radius: 0.43rem; margin: 0.8rem auto 0; display: block; } </style> <div class="errorBox"> <img src="@Url.Content("~/Thems/M2/image/error.png")" alt=""> <p class="message">@HttpUtility.UrlDecode(ViewBag.Message, Encoding.UTF8)</p> </div> <button class="back" onClick="javascript:history.back(-1);">返回</button>