asp.net在线人数统计
有人也问了个在线统计的问题,我的见意是这样的:
在Application_Start事件中加入以下代码:
Application.Lock();
Application.["UserCount"]=0;
Application.Unlock();
Session_Start事件中加入以下代码:
Application.Lock();
Application["UserCount']=Int32.Parse(Application["UserCount"].Tostring())+1;
Application.UnLock();
Session_End事件中加入以下代码:
Application.Lock();
Application["UserCount"]=Int32.Parse(Application["UserCount"].Tostring())-1;
Application.UnLock();
在要显示的地方写个函数加入以下代码:
Response.Write(Application["UserCount"].Tostring());
这就OK了
相关文档:
//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//数据库地址
private string datapatch = "db/global.asa";//数据库地址
///
/// 取得dataset
//
/// 查询语句
///
public DataSet GetDataSet(string Commandtext)
{&nbs ......
ajax 在目前 web 领域已广泛应用,其真正核心只不过是一个封装好了的 js 库。最五花八门的莫过于 asp.net 的控件,我个人认为 ajax 只是一个轻量级的东西,根本没有必要将它写成服务器组件,如 ajax.net、AjaxControlToolkit 等。所以我一直视这些组件为垃圾。。。
以下说明我为什么不认同 ajax 的相关组件: ......
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is ......
1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Attribute ......