我实施剖析了我们的网站,而我基本上只是使用的Application_BeginRequest计时器()
和 Application_EndRequest()
跟踪请求次数。
I'm implementing profiling for our site, and I'm basically just using timers in Application_BeginRequest()
and Application_EndRequest()
to track the request times.
的问题是,在 Application_EndRequest()
,我可以通过 Request.RawUrl
获得Ajax请求的URL,但我怎么能得到哪些页面发送该请求?
The issue is that in Application_EndRequest()
, I can get the Ajax request's URL by Request.RawUrl
, but how can I get which page sent this request?
推荐答案
您可以检查 Request.UrlReferrer
来获取从中发出请求的页面,但请记住,有些浏览器可能不发送引用者在Ajax请求,你应该考虑这种情况下,您的code。
You can check Request.UrlReferrer
to get the page from which the request originated but keep in mind that some browser may not send referer in ajax requests and you should account for this case in your code.
另外,你应该通过包含当前网址在所有Ajax调用额外的参数。
Alternatively, you should pass an additional parameter containing the current url in all your ajax calls.
相关推荐
最新文章