如何找到当前活动的asp.net页面 [英] How to find current active asp.net page

查看:46
本文介绍了如何找到当前活动的asp.net页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i正在使用c#在asp.net页面上工作。



我想要找到当前有效的asp.net页面。



ie;如果当前活动页面是我的asp_app ...那么它应该刷新我的页面。

喜欢:如果我的应用程序页面是当前活动页面..那么它应该刷新...



或任何其他解决方案/建议,plzzz ...帮助我。



谢谢

Hi guys,

i was working on asp.net pages using c#.

I want to find current active asp.net page.,

i.e; if the current active page is my asp_app ... then it should refresh my page.
like: if my app page is current active page.. then it should refresh...

Or any other solutions/suggestion, plzzz... help me.

Thanks

推荐答案

ASP.Net页面中没有Active这样的东西,因为Web是断开连接的介质。这意味着当有人访问您的网站时,所有C#代码都会运行,包括Page_Load事件,然后html会被发送回客户端的浏览器。如果包含任何JavaScript,您可以运行它。但此时机器已断开连接并且没有活动状态。



如果您希望在页面加载时运行代码,则可以使用Page_Load事件C#。



如果你想让代码继续在客户端运行,你可以使用JavaScript和window.setTimeout方法,它允许你运行一个x的任何函数毫秒。如果他们关闭窗口或导航到其他地方,那么你的代码就消失了,这可能只是你需要setTimeout方法。
There is no such thing as "Active" in ASP.Net pages because the web is a disconnected medium. That means that when someone visits your site all of your C# code runs, including the Page_Load event and then html is sent back to the client's browser. If there is any JavaScript included you can have it run. But at that point the machines are disconnected and there is no "Active" status.

If you want code to run when the page loads you can use the Page_Load event in C#.

If you want code to keep on running on the clientside you would use JavaScript and the window.setTimeout method which allows you to run a function ever x number of milliseconds. If they close the window or navigate somewhere else then your code is gone so it may just be that you need the setTimeout method.


你可以使用javascript来检测鼠标移动和击键事件当前页面。

如果当前页面上存在鼠标移动或击键,您可以将其视为活动。
You can use javascript to detect mouse move and key stroke event on current page.
If mouse move or key stroke existed on current page, you can consider it as "Active".


这篇关于如何找到当前活动的asp.net页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆