计算菜单点击次数并保存SqlServer数据库2005中的点击次数 [英] Count Menu clicks and save Number of clicks in SqlServer database 2005

查看:118
本文介绍了计算菜单点击次数并保存SqlServer数据库2005中的点击次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
祝大家有美好的一天!!!!!

计数菜单单击次数并保存SqlServer数据库2005中的单击次数.
================================================== =======

我已经在Asp.net C#,SqlServer 2005中创建了一个WEB应用程序.
在此Web Appl中,我在菜单中有诸如主页",关于我们",查看结果",查看排行榜",联系我们..... etc"等菜单.

当用户单击此链接时,它必须计数并存储在SqlServer 2005数据库中.
因此,我可以知道有多少用户正在查看我的Web应用程序.


请帮我兄弟.


非常感谢

Hello Friends,
Have a good day all of you !!!!!

Count Menu clicks and save Number of clicks in SqlServer database 2005.
=========================================================

I have Created a WEB Application in Asp.net C#, SqlServer 2005.

In this Web Appl I have Menus Such as Home,About us, View Result, View Toppers, Contact us....etc links in menus.

When User clicks this links it must count and store in SqlServer 2005 database.

So, that I can Know how many users are viewing my web application.


Please help me brothers.


Thanks a lot

推荐答案

兄弟,您不必那样做.

您的Web项目中有Global.asax文件.
Brother you don''t have to do like that.

you have Global.asax file in your web project.
void Application_Start(object sender, EventArgs e)     
{
   // Code that runs on application startup.        
   Application["Visitors"] = 0;
}

void Application_End(object sender, EventArgs e) 
{
        //  Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e) 
{ 
      // Code that runs when an unhandled error occurs  
}
void Session_Start(object sender, EventArgs e) 
 {
      // Code that runs when a new session is started.
       Application.Lock();
       Application["Visitors"] = Convert.ToInt32(Application["Visitors"])+1;
       Application.UnLock();
}
void Session_End(object sender, EventArgs e) 
{} 



每当session_start事件发生时,您都需要将访问者的价值提高一个& ;;您可以在数据库中插入该值.
希望对您有帮助



Whenever session_start event occurs you need to increase your visitor value by one & you can insert that value in the database.
Hope it helps


如果您想在您的网站上找到唯一的访问者,请遵循Sushil上面的建议.

如果您需要查找已访问的总页数或已访问的页数,最简单的方法就是免费使用Google Analytics(分析).您需要托管网站,以便Google Analytics(分析)可以访问它.

否则,如果您想开发自己的方法,建议您创建一个从system.page衍生的基页类,然后从此基类中派生所有页面.

在此自定义基类中,您可以对用户进行总页数和用户页数的总数和/或存储在数据库中.
希望能有所帮助.如果是这样,请将答案标记为解决方案和/或投票.

谢谢
Milind
If you want to find unique visitors to your web-site, follow what Sushil has suggested above.

If you need to find total pages visited or number of pages visited, the simplest thing to do is to go for Google analytics which is free. You need to host site so that it accessible to Google Analytics.

Else, if you want to develop your own method, I would suggest you create a base page class ederived from system.page and then derive all your pages from this your own base page class.

In this custom base class, you advance total page count and user page count and/or store in database against the user.

Hope that helps. If it does, mark the answer as solution and/or upvote.

Thanks
Milind


这篇关于计算菜单点击次数并保存SqlServer数据库2005中的点击次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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