For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > April 2005 > Request.ServerVariables("Remote_addr") in VB









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Request.ServerVariables("Remote_addr") in VB
Manish Sawjiani

2005-04-12, 8:58 am

Hello Experts

I want to trap the remote machines' name in the frmLogin to keep track of
the user. i dont know how to do this but in asp it is very simple to get the
ip address of the remote machine. Please if anyone can help me it would be
greatly appreciated!!! Thanks

Cheers
Manish Sawjiani
--
Three Cheers to technet for the Help!
Bob Butler

2005-04-12, 4:00 pm

"Manish Sawjiani" <ManishSawjiani@discussions.microsoft.com> wrote in
message news:3F1CC83A-1A71-4D8F-BB65-6C9BBA0306CA@microsoft.com
> Hello Experts
>
> I want to trap the remote machines' name in the frmLogin to keep
> track of the user. i dont know how to do this but in asp it is very
> simple to get the ip address of the remote machine. Please if anyone
> can help me it would be greatly appreciated!!! Thanks


What do you mean by the 'remote machine'? If you are running a VB
application then all you have is the local PC... also, you ask about
getting the name but then show code that gets the IP; which do you want?

To get the local hostname:

Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal HostName As String, _
ByRef BuffSize As Long) As Long

Private Sub Main()
MsgBox ComputerName
End Sub

Public Function ComputerName() As String
Dim sBuff As String
Dim lSize As Long
Dim x As Long
sBuff = Space$(64)
lSize = Len(sBuff) - 1
x = GetComputerName(sBuff, lSize)
If x > 0 And lSize > 0 Then
ComputerName = Left$(sBuff, lSize)
End If
End Function


--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Manish Sawjiani

2005-04-13, 8:58 am

Thanks Bob for understanding a question. And thanks for you reply

Regards
Manish

"Bob Butler" wrote:

> "Manish Sawjiani" <ManishSawjiani@discussions.microsoft.com> wrote in
> message news:3F1CC83A-1A71-4D8F-BB65-6C9BBA0306CA@microsoft.com
>
> What do you mean by the 'remote machine'? If you are running a VB
> application then all you have is the local PC... also, you ask about
> getting the name but then show code that gets the IP; which do you want?
>
> To get the local hostname:
>
> Private Declare Function GetComputerName Lib "kernel32" _
> Alias "GetComputerNameA" (ByVal HostName As String, _
> ByRef BuffSize As Long) As Long
>
> Private Sub Main()
> MsgBox ComputerName
> End Sub
>
> Public Function ComputerName() As String
> Dim sBuff As String
> Dim lSize As Long
> Dim x As Long
> sBuff = Space$(64)
> lSize = Len(sBuff) - 1
> x = GetComputerName(sBuff, lSize)
> If x > 0 And lSize > 0 Then
> ComputerName = Left$(sBuff, lSize)
> End If
> End Function
>
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
>

Santhana Gopalan

2005-04-22, 4:03 pm

You need to use GetHostByName WINAPI...

Refer to the link below for sample code...

http://www.developerfusion.com/show/1628/

"Manish Sawjiani" wrote:

> Hello Experts
>
> I want to trap the remote machines' name in the frmLogin to keep track of
> the user. i dont know how to do this but in asp it is very simple to get the
> ip address of the remote machine. Please if anyone can help me it would be
> greatly appreciated!!! Thanks
>
> Cheers
> Manish Sawjiani
> --
> Three Cheers to technet for the Help!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com