知道为什么我的函数没有注入网页吗?我很确定我以前做过这个并且它有效,但是当我从 VS 启动并查看页面时,我在任何地方都看不到它。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string deviceID = Guid.NewGuid().ToString();
string deviceFunction = "function GetDeviceID() { return '" + deviceID + "'; }";
ClientScript.RegisterClientScriptBlock(GetType(), "DeviceID", deviceFunction, true);
}
}