我在aspx文件中添加了C#代码,但显示错误
类或名称空间名称"Mail"在类或名称空间"System.Net"中不存在(您是否缺少程序集引用?)
我怎么能添加nampespace到aspx文件我试过<%@ import namespace="Westwind.Tools"%>但它不起作用?
我正试图在离子3移动应用程序中内嵌视频 - 我想避免启动原生视频播放器.
我正在测试iPhone 5s - iOS 10.
这是我根据我读过的所有内容创建的用于加载视频的功能:
loadVideo(src: string, onComplete?: (src: string) => void): void {
var video: HTMLVideoElement = document.createElement('video');
video.setAttribute('playsinline', '');
video.setAttribute('webkit-playsinline', '');
video.setAttribute('src', src);
var onVideoLoaded = () => {
video.removeEventListener('loadeddata', onVideoLoaded);
if (onComplete != null) onComplete(src);
};
video.addEventListener('loadeddata', onVideoLoaded);
video.load();
}
Run Code Online (Sandbox Code Playgroud)
加载完成后,我通过video.play()播放它.
该功能的另一个版本是:
loadVideo(src: string, onComplete?: (src: string) => void): void {
var video: HTMLVideoElement = document.createElement('video');
video.setAttribute('playsinline', '');
video.setAttribute('webkit-playsinline', '');
var srcElement: HTMLSourceElement = document.createElement('source');
srcElement.setAttribute('src', src);
srcElement.setAttribute('type', 'video/mp4');
var onVideoLoaded = () …Run Code Online (Sandbox Code Playgroud) 环境:
IIS 8.5
.NET Framework 版本:4.6.2(使用 WebForms)
视窗服务器 2012 R2
问题:
正在报告以下异常:
BASE EXCEPTION: System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (?).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
BASE EXCEPTION HRESUT: -2147467259
EXCEPTION: System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (?).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
Run Code Online (Sandbox Code Playgroud)
我们的日志中显示的其他信息:
PATH_INFO
/cities/index.aspx?locid=4163
----
QUERY_STRING
----
REMOTE_ADDR
66.249.65.204
----
REMOTE_HOST
66.249.65.204
----
REQUEST_METHOD
GET
----
SCRIPT_NAME
/cities/index.aspx?locid=4163
----
URL
/cities/index.aspx?locid=4163
----
HTTP_FROM
googlebot(at)googlebot.com
---- …Run Code Online (Sandbox Code Playgroud) 我能够使用以下方式将会话变量存储在aspx页面中:
$(document).ready(function () {
var userName = "webruster";
'<%Session["UserName"] = "' + userName + '"; %>';
alert('<%=Session["UserName"]%>');
});
Run Code Online (Sandbox Code Playgroud)
现在当我试图检索Session["UserName"]我无法在cs中获得该值.为此,我有一个工作,但想知道它失败的原因?
替代方式:
声明隐藏的变量和链接按钮
$(document).ready(function () {
var userName = "webruster";
'<%Session["UserName"] = "' + userName + '"; %>';
var x = document.getElementById("<%=hdnsessionvalue.ClientID %>");
x.value = '<%=Session["UserName"] %>';
document.getElementById('<%= lnkButton1.ClientID %>').click();
});
Run Code Online (Sandbox Code Playgroud)
所以我能够onclick在服务器端检索事件中的值.
我的问题: 那么为什么我无法使用第一种方法检索cs中的会话值(即没有分配隐藏变量)