cancel
Showing results for 
Search instead for 
Did you mean: 

Get Client Details...

Former Member
0 Kudos

Hi ,

In web Dynrpo please let me know how to get Windows NT user id and Computername / Hostname .

I get the IP address by

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getClientHostAddress()

but could not get the computer name by

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getClientHostName()

. It displays only ip address. Also how to get the windows logged in user name. I am on NW 7.0 SP17 .

Thanks in advance

Vasu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This is the ServletRequest javadoc for "getRemoteHost":

Returns the fully qualified name of the client that sent the request, or the IP address of the client if the name cannot be determined. For HTTP servlets, same as the value of the CGI variable REMOTE_HOST.

CGI Info would be:

The hostname of the visitor (if your server has reverse-name-lookups on; otherwise this is the IP address again).

So I guess you are stuck with your IP address in this case.

To access which user is perfoming the Request, you can use "getRemoteUser" of HttpServletRequest. Remember that, it will send you the authenticated user.

CGI Info would be:

The visitor's username (for .htaccess-protected pages).

So this might be different from your "Windows User".

Regards,

Daniel

Former Member
0 Kudos

Hi Daniel,

Please let me know how to access the ServletRequest object in Web dynpro.

Regards

Vasu

Former Member
0 Kudos

HttpServletRequest requestObject = (HttpServletRequest) TaskBinder.getCurrentTask().getProtocolAdapter().getRequestObjectInternal().getProtocolRequest();

You need to add an Used DC, type JEE -> servlet for compilation.

Regards,

Daniel

Former Member
0 Kudos

Thanks Daniel. I tried the methods getRemoteHost and getRemoteUser but i am getting the IP address of the client machine and portal user id . I am looking for windows logged in user id and the hostname / computer name of the logged in user.

Regards

Vasu

Former Member
0 Kudos

In this case, read what I said before.

This is how the Request works, I said before it would return the authenticated user and not Windows user. There's the explanation for your problem with the host name as well.

About the current user, you would need access to client's machine (same as Host name, using something from java.net package (INetAddress probably) - You could also return the system user name with something like System.getProperty("user.name").

Hope it helps somehow..

Regards,

Daniel

Former Member
0 Kudos

Thanks Daniel. I already tried using INetAddress but still getting the IPaddress. Let me know if you have any other ideas.

Regards

Vasu