Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

How to retrieve workstation hostname

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 05-26-2007   #1 (permalink)
Tolu
Guest


 

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
Guest


 

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
Guest


 

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
Guest


 

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
Guest


 

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
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP need fully qualified hostname David Vista mail 0 03-26-2008 05:07 AM
Extract hostname from distinguished name cmyers PowerShell 11 02-07-2008 08:44 AM
Hostname to IP translation Joe Freedom PowerShell 14 12-12-2007 09:47 AM
Invalid Hostname Oscette Vista networking & sharing 0 01-28-2007 01:34 AM
Getting hostname in Windows Powershell =?Utf-8?B?YnJhdG8=?= PowerShell 4 08-14-2006 04:16 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51