on 02-22-2010 4:29 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.