LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot set cookies with webservice with NI web server?

I started tinkering with setting cookies in order to recognize requests from a browser that succesfully logged in. However, I get the strangest error when I want to set the cookie:

 

Error -67309 occurred at an unidentified location

Possible reason(s):

LabVIEW: (Hex 0xFFFEF913) LabVIEW Web Services: Unsupported node for NI Web Server.

 

I can't imagine that NI web server does not support the session vi's. A thought maybe the cookie is being blocked by the client browser, but that is not the case.

aartjan_0-1636318032247.png

 

I did figure out that this VI resides in the application web server subpalette. So do I have to switch over to the application web server for something as basic as cookies? And besides: how am I ever going to properly use the application web server that requires the long unsupported Silverlight browser plugin?

0 Kudos
Message 1 of 7
(3,416 Views)

Great question.......

Message 2 of 7
(3,335 Views)

I am currently not using the application web server. I use the NI web server and figured out how to manually set cookies.

0 Kudos
Message 3 of 7
(3,301 Views)

Would you mind sharing an example?

 

Thanks

M

0 Kudos
Message 4 of 7
(3,285 Views)

I hope this will help somebody

Example project is attached.

The idea is: check cookies. If this vi returns an error, it means that session does not exist. So I open the login page and if successful, the user can get the data. And the session exists until the browser will be closed.

Here is only one problem. The login VI changes address from "ted data" to "get access". May be anybode knows how to fix it?check.pngexists.pnglogin.png

0 Kudos
Message 5 of 7
(2,816 Views)

The VI Snippet's by @Artem.SPb will only work for the the "old" application web server not with the new NI Web Server.

 

I'm currently working on a project that is using the NI Web Server and also needs to work with Cookies and Sessions for connected Clients.

 

  1. In my case a client is requesting a new session by calling the web server. The web server then responds with a SetCookie Header so the client will save the Cookie for a specific time.
  2. For ever request to the server the client will automatically send the Cookie with every request to identify itself (every modern Browser will do this for you automatically).
  3. For every client request the server is checking the ClientID by using the "Read Request Variable.vi" from the "Web Service Palette"

Jens_S_0-1668420300608.png

 

There might be some other solutions but for me this is working perfectly fine.

0 Kudos
Message 6 of 7
(2,776 Views)

 


@Jens_S wrote:

The VI Snippet's by @Artem.SPb will only work for the the "old" application web server not with the new NI Web Server.

 

I'm currently working on a project that is using the NI Web Server and also needs to work with Cookies and Sessions for connected Clients.

Jens_S_0-1668420300608.png



Thanks for the addition.
You're right, my first option doesn't always work, I figured it out myself in tests on different machines. And it's not just the "old" server. So I now create cookies as shown in my last snippet, and then I check in much the same way as it is shown in yours.

Message 7 of 7
(2,758 Views)