如何从httphandler调用JavaScript函数
我的问题很简单,如何从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
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。。。有没有办法做到这一点@穆罕默德·希里扎德