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了
相关文档:
下面要解决的问题如下:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:
&nbs ......
public class PageBase:System.Web.UI.Page
{
public PageBase()
{
//
// TODO: Add constructor logic here
//
}
protected override void InitializeCulture()
{
// ......
ASP.NET 配置节架构包含控制 ASP.NET Web 应用程序行为的元素。如果为属性指定了默认值,则该默认值是在 Machine.config 文件中设置的,该文件的路径是 systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config。
<configuration>
<location>
......
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 ......