|
Mr Business Kid wrote: Regardless of whether or not I set the logout time to 20 minutes later, 4 hours later, or 1 day later - I could actually be updating their status as being logged out of the application when they are in fact logged into the application. Do you have any other ideas?
There's really no way around this. Your server-side code cannot know if the user is either just sitting there staring at a page, or if the user closed the browser. There is no event that's fired on the client-side that the browser is closing down. No event means no notification to the server.
This is just a fact of web life you have to put up with.
|
|
|
|
|
Well, the only other thing you can try is to embedd an AJAX call in all your pages so that it sends a message logging them out. This is also not going to work 100% of the time, which is why a timeout is a good idea.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
the following catches the user changing the page, leaving your website, closing down the browser. you fire one last call of (ajax or whatever) to log the user off. I didn't code for it but if the navigation came from the page then ignore the unload event, if it came from somewhere else, the event fires... not perfect but it works
<html>
<script language="javascript">
function LoadMe()
{
alert("hi")
}
function UnloadMe()
{
alert("Bye")
}
</script>
<body onload="LoadMe()" onunload="UnloadMe()">
<form action="test.htm">
hello
<a href="test.htm">me</a>
<a href="http://www.yahoo.com">yahoo</a>
</form>
</body>
</html>
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
<div class="ForumMod">modified on Monday, March 17, 2008 10:18 PM</div>
|
|
|
|
|
I created a dataTable which I am using to populate a combo box. When I select a student fromthe student combo box the lesson combo box is populated with info from the data table. When I select a student with the student combo box I get the following error.
Can you tell me why?
Here is the function that is giving me the error.
Public Function selectLesson() As DataTable
' declare data table
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add(New DataColumn("lessonTime", GetType(String)))
dt.Columns.Add(New DataColumn("lessonID", GetType(String)))
For Each row As DataRow In dtLessTime.Rows
dr = dt.NewRow()
dr(0) = " " & arrWeekDays(Convert.ToInt32(row("less_day")) - 1) ' & " " & Convert.ToDateTime(row("less_time"))
dr(1) = row("less_id")
dt.Rows.Add(dr)
Next
Return dt
End Function
|
|
|
|
|
Well, the code that creates this new table, and adds rows to it, looks OK. The problem may be that the dtLessTime.Rows collection may be empty, or some other problem with it.
|
|
|
|
|
I'm sure this has been addressed, but I can't seem to find it. Sometimes when I open another window from a dropdown, the dropdown box items remain glued to the screen. The box just sits there in front of every other window, and never goes away. What am I doing wrong?
Thanks
|
|
|
|
|
cstrader232 wrote: Sometimes when I open another window from a dropdown, the dropdown box items remain glued to the screen. The box just sits there in front of every other window, and never goes away.
I can't duplicate the problem. Have you tried updating your video card drivers?
|
|
|
|
|
I am having trouble connecting to my pc using a mobile device. I created a tcplistener on my pc and am trying to put a tcpClient or socket on the device but am having trouble. I hope someone can help me.
This is the code I have for the device. I have tried this different ways depending on what search engine results I got. Here is my latest:
Dim tcpCli As New Sockets.TcpClient("lit3.local.local", 2048)
Dim ns As NetworkStream = tcpCli.GetStream()
Dim sw As New StreamWriter(ns)
sw.WriteLine("BUYER")
sw.Flush()
I also tried:
Dim sock As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim ipep As IPEndPoint = New IPEndPoint(IPAddress.Parse("194.268.150.142"), 2048)
sock.Connect(ipep)
Dim ns As NetworkStream = New NetworkStream(sock)
Dim sw As New StreamWriter(ns)
sw.WriteLine("BUYER")
sw.Flush()
I am trying to send a string to my computer so my application can test the string and do a certain method depending on the string.
Can someone help me?
Thank you.
|
|
|
|
|
Well, both examples you posted are missing things. The first doesn't connection to the target at all. The second connects, but does retrieve the underlying stream. So, you combine the two and you get something like this:
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("127.0.0.1", 8000)
Dim networkStream As NetworkStream = tcpClient.GetStream()
If networkStream.CanWrite And networkStream.CanRead Then
Dim sendBytes() As Byte = Encoding.ASCII.GetBytes("Is anybody there")
networkStream.Write(sendBytes, 0, sendBytes.Length)
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
Dim returndata As String = Encoding.ASCII.GetString(bytes)
|
|
|
|
|
Thank you for helping me on this. But, I get an error on the second line of code: target machine actively refused it.
Let me show you how I have this set up so you can clearly see any problems.
Server - My PC on a network separate application of desktop where listener is
Code:
Dim desktop As SteidingerDesktop = New SteidingerDesktop
Dim localhostAddress As IPAddress = IPAddress.Loopback
Dim tcpList As New TcpListener(localhostAddress, 2048)
tcpList.Start()
Do
Dim tcpcli As TcpClient = tcpList.AcceptTcpClient
Dim ns As NetworkStream = tcpcli.GetStream
Dim sr As New StreamReader(ns)
Dim receivedData As String = sr.ReadLine()
Dim result As Boolean
If receivedData <> "" Then
'Test the received data to see which function to call
If receivedData = "BUYER" Then
result = desktop.getBuyers()
ElseIf receivedData = "SHIP" Then
result = desktop.updateShip()
ElseIf receivedData = "MOVE" Then
result = desktop.updateMove()
ElseIf receivedData = "PHYINV" Then
result = desktop.updatePhyInv()
End If
Try
' resultData = file.ReadAllText(fileName)
Catch ex As Exception
'send back result result = "ERROR"
End Try
'Send result
SendData(ns, result)
End If
sr.Close()
ns.Close()
tcpcli.Close()
If receivedData = "" Then Exit Do
Loop
tcpList.Stop()
Client - mobile device barcode scanner on wireless
Code:Your code.
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("ipaddress of my desktop", 2048)
Dim networkStream As NetworkStream = tcpClient.GetStream()
If networkStream.CanWrite And networkStream.CanRead Then
Dim sendBytes() As Byte = Encoding.ASCII.GetBytes("Buyer")
networkStream.Write(sendBytes, 0, sendBytes.Length)
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
Dim returndata As String = Encoding.ASCII.GetString(bytes, 0, bytes.Length)
End If
Can you look at this code and tell me why I get the error? thank you.
|
|
|
|
|
Hey
I want to draw in a user control, but for some reason it doesn't work. The user control colors blue, but I can't see a yellow circle. Maybe it would be better to make a panel - user control, but I don't know how to do this.
<br />
Public Class cell<br />
Private Sub cell_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
'Set Background of cell (panel)<br />
pnlCell.BackColor = Color.Blue<br />
<br />
'Draw circle in cell (panel)<br />
DrawCircle(New Point(10, 10), 5)<br />
End Sub<br />
<br />
Private Sub DrawCircle(ByVal p As Point, ByVal radius As Integer)<br />
Dim gr As Graphics = pnlCell.CreateGraphics<br />
Dim rect As Rectangle = New Rectangle(p.X - radius, p.Y - radius, 2 * radius, 2 * radius)<br />
gr.FillEllipse(Brushes.Yellow, rect)<br />
End Sub<br />
End Class
|
|
|
|
|
Your drawing code should be in the Paint event of your UserControl, not called from form load.
|
|
|
|
|
N!ck wrote: Dim gr As Graphics = pnlCell.CreateGraphics
To expand on the previous reply - CreateGraphics is used to draw something that is temporary, it gets erased the moment the control redraws itself. After the control loads, it will become visible, and will redraw itself.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I want to take snap shot current application which is running on the other machine.
How Can I go further?
Regards,
sjs4u
|
|
|
|
|
Unless you write two applications, you can't do this. The "other machine" has to be running an application that listens for a connection from your other application running on your machine. When that connection is established and a command given (your choice of what you want to use here), then your client application can take the snapshot and send it back to the server.
|
|
|
|
|
Why are you asking this over and over, on all the forums, but when someone gives you an intelligent answer, you just repeat the question ? It's obviously beyond you, stop spamming the site, and read the replies you have been given.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi i am creating my own application and i wan to have a list simmaler to the contacts list within MSN messenger e.g a pucture with three lines of text along side this driven from a data souce im fine withe everything apart from how do i manipulate the grid view(if this is the correct control) to show a picture in column one with three text rows in colum two?
any help would be grately appreciated
|
|
|
|
|
|
I want to load .exe file which is created using VB.Net or C#.Net Application.
After installing when my computer starts that exe run.
I am creating set up of the project.
|
|
|
|
|
I *think* you're saying you want to add a path to your exe in the startup folder of the run menu, so it starts when the PC starts.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hai SJS4U..
I understood your problem..
for every restart of your PC your application has to be lunch automatically at the start-up.
For this one you have to place your exe stortcut in startup folder..
But We(.net Developers) have a option when we are creating Setup of our application.
Follow the Steps:
--> Goto File System window in setup application.
--> Right Click on the Root (File System on target Machine). U will get the menu ADD SPECIAL FLODER , then select USER'S START MENU.
--> U Will get a Folder in sub-root.
--> Place your EXE short cut in that folder..
--> Built Setup. ( Do Remaining things normally.)
--> Now Install Your Application and restart Your PC.
Thanks
Rajesh B.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Thanks for the Valuable information.
I trid but it is not running when I restarts the PC.
I Copied shortcut of my exe into the user's start Menu folder.
and Buld it but it is not working.
|
|
|
|
|
It *has* to work. IF the shortcut is there, windows will run it when it starts. No question. The problem lies elsewhere.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi...,
Clarify me u create setup
or
create shortcut manually in the startup folder.
if copied shortcut directly., try with setup it will work 100%.
replay me..
Thanks
Rajesh B
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Yes.
Now its Work
Thank you so much.
Regards,
sjs4u
|
|
|
|