Solution for ASP to read Windows login name from the client

Source: Internet
Author: User

I don't know why my friends have such strange requirements. Use ASP to obtain the user's Windows logon name. No suitable method was found. Only this method is supported. It is to use the server component and client component to communicate through socket. ASP calls the server component to use socket to send a request to the client component running on the viewer's computer. The client component obtains the Windows login name of the viewer and then uses Socket to return the request to the server component. The server component then returns the result to ASPProgram.

Both server components and client programs are written in VB6:

Source: http://files.cnblogs.com/zxsoft/use aspto get the Windows host name to the client. rar

 

Solution: use ASP to obtain the Windows User Logon Name of the Client

 

 

ASP has not found how to obtain the Windows login name of the client. Therefore, you have to use the components.

 

You have confirmed that the ASP server script cannot create client components. Therefore, you have to use the COM component on the server and the client component through socket communication. Therefore, components must be installed on both the server and client.

 

Principle:

 

The client browser accesses the ASP file. The ASP file obtains the Client IP address and creates a server component. " Zxsoft. GetUserName " And send the Client IP address as a parameter to the server component. The server component uses TCP protocol to communicate with the client through socket. The client obtains the Windows Logon Name of the local computer. And use socket to return to the server component. ASP files use server components to obtain the Windows logon name of the client.

 

Directory structure description:

 

Release

|

------ Client exe---- Programs that must be installed on each client machine. Set to automatically run at startup

|

------ Sample ASP---- ASP example of using this solution

|

------ Server com DLL---- COM component of the server. Use regsvr32 to register on the ASP Server

 

SRC

|

------ Server COM Component---- VB6 of the server COM ComponentSource code

|

------ Client---- VB6 source of the ClientCode

 

Server Component Description:

 

Component Name:Zxsoft. GetUserName

ASP creation method:Set GetUserName = server. Createobject ("zxsoft. GetUserName ")

Method list: GetUserName (IP as string, optional timeoutsecond as string = 3) as string

Parameter description:IPTo obtain the IP address of the Windows login Client

Timeoutsecond, Optional, timeout. The client does not return a socket when the timeout is exceeded. An error occurred while obtaining the Windows login name. The default value is3(Seconds ).

Function:Obtain the Windows logon name of the client whose IP address is the parameter IP address.

Return Value:String. The Windows login name obtained. If the request fails, an empty string "" is returned "".

 

 

Client program description:

 

No display is displayed during running. Getusername.exe will be viewed in the process. To exit the terminal, terminate the getusername.exe process. If the client program is not running. You cannot obtain the Windows logon name. Therefore, we recommend that you set this program to automatically run on the client computer.

 

Author: Zhang Xuan

2007.8.2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.