LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read user name on web page?

I would like to build an application that publishes data to the web, but I would also like to be able to read the user who is trying to view the page and give them access.  The users would only be read from a local intranet.
 
 
Any ideas?
 
Thanks
Bryan
0 Kudos
Message 1 of 9
(4,129 Views)

Do you mean see the username of the person who is accessing the data?  If so, do you have a login page so that the user's must login to access the data?  Are you using CGI VIs from the Internet package?

 

 

0 Kudos
Message 2 of 9
(4,120 Views)

Nate,

No I currently don't have the internet toolkit, but I could upgrade if it is needed.  I don't have a login popup, I would prefer to read the users windows login. 

 

Thanks

Bryan

0 Kudos
Message 3 of 9
(4,111 Views)
Here is a method to read the %username% environment variable.
 
0 Kudos
Message 4 of 9
(4,102 Views)
That's an excellent example and should serve your purposes regarding determining the current username. Also remember that LabVIEW has some inherent access control for its web server. If you are publishing your VI itself using the LabVIEW web server utility, you can control access based on IP addresses or domain names. You can, for instance, block any users from a given subnet by specifying in your access list (Tools >> Options >> Web Server: Browser Access) to deny access to 192.168.1.*, where * is the wildcard character.
Jarrod S.
National Instruments
0 Kudos
Message 5 of 9
(4,087 Views)
Thanks for the example VI, but that only reads the username on the machine that it is run on.  I need the username of the person trying to view the VI from the web. 
 
The I.P. mask won't work, our local intranet uses a dynamic I.P. assignment.
The idea is to limit the data to engineering employees and not to marketing employees.  I know I could have some sort of login on the VI but I would like to avoid that sort of senario.
 
Thanks for the help
0 Kudos
Message 6 of 9
(4,080 Views)
How does this user get access to the computer?? There are some security vi's in the DSC module.
0 Kudos
Message 7 of 9
(4,075 Views)
If the VI is access through the web publishing tool, then the use doesn't need access to the computer just access to the intranet.
0 Kudos
Message 8 of 9
(4,064 Views)

Another option would be to use the Internet Toolkit to obtain and store information about the user based on cookies. Cookies can not only store information about the current state of a CGI application, but also information such as user ID or login identification.

It is possible you would still need to implement a login page that users would go through before accessing the data if the user's browser blocks cookies or keeps your web server from automatically obtaining user information.

The Internet Toolkit has the added benefit of allowing you to embed an application in a web page using the G Web Server that users can access without needing to have the LabVIEW Run-Time Engine installed on their machines.

Just search ni.com for Internet Toolkit for a great deal of useful information.

 

Jarrod S.
National Instruments
0 Kudos
Message 9 of 9
(4,045 Views)