Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从httphandler调用JavaScript函数_Javascript_Vb.net_Httphandler - Fatal编程技术网

如何从httphandler调用JavaScript函数

如何从httphandler调用JavaScript函数,javascript,vb.net,httphandler,Javascript,Vb.net,Httphandler,我的问题很简单,如何从httphandler调用JavaScript函数runExec()?这不管用 ScriptManager.RegisterStartupScript(Me,Me.GetType(),“myFunction”,“runExec();”,True) 它给了我以下的错误 Error 5 Overload resolution failed because no accessible 'RegisterStartupScript' can be called with t

我的问题很简单,如何从httphandler调用JavaScript函数
runExec()
?这不管用

ScriptManager.RegisterStartupScript(Me,Me.GetType(),“myFunction”,“runExec();”,True)

它给了我以下的错误

Error   5   Overload resolution failed because no accessible 'RegisterStartupScript' can be called with these arguments:
    'Public Shared Sub RegisterStartupScript(control As System.Web.UI.Control, type As System.Type, key As String, script As String, addScriptTags As Boolean)': Value of type 'Sample' cannot be converted to 'System.Web.UI.Control'.
    'Public Shared Sub RegisterStartupScript(page As System.Web.UI.Page, type As System.Type, key As String, script As String, addScriptTags As Boolean)': Value of type 'Sample' cannot be converted to 'System.Web.UI.Page'.  C:\Users\Fares\Desktop\RemotePayment 13.10.2014\Sample.ashx 144 17  C:\...\RemotePayment 13.10.2014\
根据,是“端点”。因此,您不能提示客户端运行javascript代码。当您响应一个请求时,我唯一能说的是您可以将javascript代码写入响应,然后在客户端浏览器中运行它。像这样的事情:

Public Sub ProcessRequest(context As HttpContext)
...
    context.Response.Write("<script>muFunc();</script>")
...
End Sub
公共子进程请求(上下文为HttpContext)
...
Write(“muFunc();”)
...
端接头

这仅在您的请求是文本/html请求时有效。

这是我第一次实现httphandler。。。有没有办法做到这一点@穆罕默德·希里扎德