LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I modify an env variable in one CGI app to be read in a second CGI app?

I have two cgi apps. The first one reads the REMOTE_USER and REMOTE_IDENT env variables and check the user's credentials in a database. If the user does not have rights to let him view the HTML generated by the first app, the REOMOTE_USER and REMOTE_IDENT are nulled (I do this by using the keyed array add vi) and the user is redirected to a login app (the second cgi app). The login app places "Status: 401 Password Required" in the header of the CGI write reply vi if the REMOTE_USER and REMOTE_IDENT are null. The problem is that although I nulled the REMOTE_USER and REMOTE_IDENT variables in the first app, when I read them in the second app, they have retained their previous values. In other words they are not NULL. Why?
0 Kudos
Message 1 of 7
(3,217 Views)
Hi Waldo,

Please submit your code for easier troubleshooting, thanks. In case this is not possible, consider posting an image of the block diagram.

Thanks!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 7
(3,206 Views)
Hi Waldo

It is a well known problem! From the cgi vi you CAN NOT null the REOMOTE_USER. REOMOTE_USER Is the Internet Explorer variable and will be returned as long as the IE is opened. It will be nulled after you close it completelly, which is not what you need.

The example from NI showing authorisation using REOMOTE_USER is not helpfull. It leads in wrong way and you will spend a lot of time to figure it our. The G web server is not supporting all necessary tools to play with the environmental variables of CGI server.

The solution is as follows:
1. Forget about REOMOTE_USER.
2. Do it with server and client-side cookies.
3. Cookie will keep the user credentials and will allow to keep html status information.
4. Client cookie use with: CGI Set Client Side Cookie.vi
5. There is a serious bug in server side cookie vis regarding the life time of a cookie. I have reported it to NI - no answer.
6. When you solve all bugs with cookies you will find them very very useful.

hope it helps
Pawel
0 Kudos
Message 3 of 7
(3,205 Views)
Thanks Pawel!

After much trial and error, I have come to the same conclusion as you. I ended up using a client-side cookie in order to maintain state info. It is quite simple to manipulate client-side cookies in LabVIEW.

Thanks again for your valued input!

Waldo
0 Kudos
Message 4 of 7
(3,197 Views)
Hi Pavel,

Your information is very helpful. However, you say that you reported an issue with the cookie VIs. Please give me some further information on this so I can follow up on this issue and make sure that it was properly reported to the R&D team.

Thanks!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 5 of 7
(3,189 Views)
Hi Philip

I tried to find my earlier post in this service, but I cannot.

Anyways, the problem with cookies is with server side cookies regarding the expiration time. I remember I needed to change some cookie vi in order to make a proper time-decoding and expiration time.

I can send you my vi, if you give me your e-mail.
You can phone me (Denmark) 47 38 00 22

cheers
Pawel Pocwiardowski
0 Kudos
Message 6 of 7
(3,182 Views)
Hi Pawel,

I'm actually situated in Austin/Texas, but we have an excellent team of AEs in Hørsholm who can help you submit this issue again. You can contact them directly on phone 4576 2600.

Pawel, we appreciate your time and effort - tak for hjælpen!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 7 of 7
(3,173 Views)