有没有办法让我跟踪哪个网页点击按钮。
例如 Default1.aspx 按钮1单击
然后在我的日志文件中。我的日志文件将记录该按钮1单击default1页面。
可以在global.asax文件的beginrequest事件中执行此操作吗? 请给我一个解决方案。
这是我的global.asax
代码 protected void Application_Start(object sender, EventArgs e)
{
// Set logfile name and application name variables
string l4net = Server.MapPath("~/log4Net.config");
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(l4net));
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
//What should i code here???
}
非常感谢任何帮助
答案 0 :(得分:0)
是的,你当然可以做到。
您可以使用
获取当前页面var page = HttpContext.Current.Request.Url;
并且按钮出现在事件目标
中var button = HttpContext.Current.Request.Params["__EVENTTARGET"];
这会为您提供控件的ClientID,但您应该可以从中提取控件ID。