Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - How to retrieve workstation hostname

 
 
Old 05-26-2007   #1 (permalink)
Tolu


 
 

How to retrieve workstation hostname

Please can anyone tell me how to get the hostname of the client workstation
from the service. I've been trying to work with
System.ServiceModel.OperationContext.Current but I haven't got it yet.

Thanks


My System SpecsSystem Spec
Old 05-26-2007   #2 (permalink)
Tolu


 
 

Re: How to retrieve workstation hostname

I'm using anonymous authentication on net.tcp. Is there a way to get the
ipaddress or hostname despite this. Logically, the service must have a
network address to route the return packets to so ...

"Tolu" <tolumania@hotmail.com> wrote in message
news:40F1CCB3-7426-4A1D-8C1B-48904BDE2439@microsoft.com...
> Please can anyone tell me how to get the hostname of the client
> workstation from the service. I've been trying to work with
> System.ServiceModel.OperationContext.Current but I haven't got it yet.
>
> Thanks


My System SpecsSystem Spec
Old 05-27-2007   #3 (permalink)
Arkady Frenkel


 
 

Re: How to retrieve workstation hostname

Try
if (OperationContext.Current.Channel.RemoteAddress.Uri.IsAbsoluteUri)

ret =
OperationContext.Current.Channel.RemoteAddress.Uri.AbsoluteUri.ToString();

else

ret = OperationContext.Current.Channel.RemoteAddress.Uri.ToString();


Arkady

"Tolu" <tolumania@hotmail.com> wrote in message
news:0A87EA3C-3319-45C8-85C3-2855D6072CFB@microsoft.com...
> I'm using anonymous authentication on net.tcp. Is there a way to get the
> ipaddress or hostname despite this. Logically, the service must have a
> network address to route the return packets to so ...
>
> "Tolu" <tolumania@hotmail.com> wrote in message
> news:40F1CCB3-7426-4A1D-8C1B-48904BDE2439@microsoft.com...
>> Please can anyone tell me how to get the hostname of the client
>> workstation from the service. I've been trying to work with
>> System.ServiceModel.OperationContext.Current but I haven't got it yet.
>>
>> Thanks

>



My System SpecsSystem Spec
Old 05-27-2007   #4 (permalink)
Tolu


 
 

Re: How to retrieve workstation hostname

Thanks Arkady,

Apparently the RemoteAddress uri is an AnonymousUri so this does not work.
After some research, I found out it is not possible to get the client's
address. Many people have thrashed MS for this but the official position on
MSDN and blogs is that this is necessary to be able to support NAT,
firewall, proxies, etc. It seems the only way to get the hostname or IP
address is for the client to send it deliberately to the service. Thanks
anyway. Perhaps MS would like to do something about this before finalizing
..Net 3.5.


My System SpecsSystem Spec
Old 05-28-2007   #5 (permalink)
Arkady Frenkel


 
 

Re: How to retrieve workstation hostname

That work for me as a charm but not with AnonymousUri.
The other way to use Native ( windows ) api : GetTcpTable()
Arkady

"Tolu" <tolumania@hotmail.com> wrote in message
news:F0BFAD77-6F2D-4286-AFA6-D67A083EEF0B@microsoft.com...
> Thanks Arkady,
>
> Apparently the RemoteAddress uri is an AnonymousUri so this does not work.
> After some research, I found out it is not possible to get the client's
> address. Many people have thrashed MS for this but the official position
> on MSDN and blogs is that this is necessary to be able to support NAT,
> firewall, proxies, etc. It seems the only way to get the hostname or IP
> address is for the client to send it deliberately to the service. Thanks
> anyway. Perhaps MS would like to do something about this before finalizing
> .Net 3.5.
>
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Hostname -> IP Address VB Script
Extract hostname from distinguished name PowerShell
Hostname to IP translation PowerShell
Invalid Hostname Vista networking & sharing
Getting hostname in Windows Powershell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46