【发布时间】:2017-07-05 16:51:27
【问题描述】:
如何在 .aspx 页面上的 HttpContext.Current.Request.Url.Host 和 HttpContext.Current.Request.Url.Authority 之间使用带有样式的三元条件 - url 标记(想直接检查是否为 localhost) ?
示例如下:
"div style='<%= "height: 1115px; background-image: url(\"" + "http://" + HttpContext.Current.Request.Url.Host.ToString() +"ImagePath"); background-position: bottom center; background-repeat: no-repeat;" %>'"
我想检查它是否是本地主机,那么它会占用权限,如果不是,那么它必须占用主机。
【问题讨论】:
-
你能发一个你想要的样本吗?
-
@PatrickHofman - 从我的项目中添加了一个 div 标签。
标签: c# asp.net webforms .net-3.5