那有什么办法让计算机过一段时间自动检察当前application里面的用户是否还在呢? 当客户关闭主页后我就调用了一个网页,里面只有一句话: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Application("allonline") = Replace(Application("allonline"), Session("currentloginuser"), "") End Sub 要不然显示当前在线用户的时候,那个死了机的人也还在。
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then Dim myconn As New SqlConnection("server=nikko3;database=iteminf;uid=sa;pwd=") Dim sqlwhere As String Dim i As Integer = 0 sqlwhere = "select name,ipaddress from userinfo" myconn.Open() Dim da As New SqlDataAdapter(sqlwhere, myconn) Dim ds As New DataSet() da.Fill(ds, "receiver") sendto.DataTextField = ds.Tables("receiver").Columns(0).ColumnName sendto.DataValueField = ds.Tables("receiver").Columns(1).ColumnName sendto.DataSource = ds.Tables(0).DefaultView sendto.DataBind() End If 'If Request.QueryString("sendto") <> "" Then ' sendto.Items.FindByText("陈廖英").Selected = True 'End If End Sub 下拉框就与这个有关,该网页是用另一个窗口中下面的代码中打开: Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand If e.CommandName = "Select" Then RegisterStartupScript("sendmessage1", "<script language=javascript>window.showModalDialog('发送短信.aspx?sendto=郭先生','newwin','dialogHeight:151px; dialogWidth: 369px; dialogTop: 200px; dialogLeft: 300px; edge: Raised; center: Yes; help: Yes;fullscreen:yes;toolbar:no;location:no;directories:no;menubar:no;,scrollbars:no; resizable:Yes; status: no;');</script>") End If End Sub
1. no good method, either use Session_End or create your own schema using Cache object, consultPreventing Multiple Logins in ASP.NET http://www.eggheadcafe.com/articles/20030418.aspPrevent Multiple Logins Using the Cache in ASP.NET http://www.eggheadcafe.com/articles/20030416.asp 2. where is this DropDownList? did you set AutoPostBack=true on the dropdown?
当客户关闭主页后我就调用了一个网页,里面只有一句话:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Application("allonline") = Replace(Application("allonline"), Session("currentloginuser"), "")
End Sub
要不然显示当前在线用户的时候,那个死了机的人也还在。
If Not IsPostBack Then
Dim myconn As New SqlConnection("server=nikko3;database=iteminf;uid=sa;pwd=")
Dim sqlwhere As String
Dim i As Integer = 0
sqlwhere = "select name,ipaddress from userinfo"
myconn.Open()
Dim da As New SqlDataAdapter(sqlwhere, myconn)
Dim ds As New DataSet()
da.Fill(ds, "receiver")
sendto.DataTextField = ds.Tables("receiver").Columns(0).ColumnName
sendto.DataValueField = ds.Tables("receiver").Columns(1).ColumnName
sendto.DataSource = ds.Tables(0).DefaultView
sendto.DataBind()
End If
'If Request.QueryString("sendto") <> "" Then
' sendto.Items.FindByText("陈廖英").Selected = True
'End If
End Sub 下拉框就与这个有关,该网页是用另一个窗口中下面的代码中打开:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
If e.CommandName = "Select" Then
RegisterStartupScript("sendmessage1", "<script language=javascript>window.showModalDialog('发送短信.aspx?sendto=郭先生','newwin','dialogHeight:151px; dialogWidth: 369px; dialogTop: 200px; dialogLeft: 300px; edge: Raised; center: Yes; help: Yes;fullscreen:yes;toolbar:no;location:no;directories:no;menubar:no;,scrollbars:no; resizable:Yes; status: no;');</script>")
End If
End Sub
http://www.eggheadcafe.com/articles/20030418.aspPrevent Multiple Logins Using the Cache in ASP.NET
http://www.eggheadcafe.com/articles/20030416.asp
2. where is this DropDownList? did you set AutoPostBack=true on the dropdown?
你看一下,你的每个ListItem的Value是否有相同的,如是有两项是相同的,则不能选取后一个