Jump to content


Photo
- - - - -

HTTPS Client login help needed

https dotnet client login cookie

  • Please log in to reply
4 replies to this topic

#1 WMassey

WMassey

    Very Active

  • Members
  • PipPipPip
  • 216 posts

Posted 15 July 2012 - 09:04 PM

I am trying to use the HTTP Client VIs to implement a version of the C# code found HERE. Unfortunately there are no NI examples of how the client VIs are to be used and my various attempts to string them together only seem to result in "Error 42" (LabVIEW: Generic Error) from the POST vi, rather than returning the headers and body text.

I have also tried using DOTNET calls and was at least able to get the login page returned but could not seem to trigger the login.

I switched to the HTTP Client VIs because they offered an alternate hope and I could at least see where to attach a cookie file with them (though a cookie file may not be the same as reserving space for a session cookie).

Any guidance would be appreciated!

Attached Thumbnails

  • DotNet VI.jpg
  • HTTP_Client VI.jpg


#2 asbo

asbo

    I have no idea what you're talking about... so:

  • V I Engineering, Inc.
  • 1,273 posts
  • Version:LabVIEW 2011
  • Since:2008

Posted 17 July 2012 - 04:55 PM

You might consider checking out libcurl. They have a C binding, so you should just be able to drop CLNs and go nuts with it. I have had excellent luck in the past using libcurl (via php) to automate HTTP/HTTPS transactions.

#3 ShaunR

ShaunR

    LabVIEW Archetype

  • Members
  • PipPipPipPipPipPip
  • 2,224 posts
  • Version:LabVIEW 2009
  • Since:1994

Posted 17 July 2012 - 06:19 PM

I am trying to use the HTTP Client VIs to implement a version of the C# code found HERE. Unfortunately there are no NI examples of how the client VIs are to be used and my various attempts to string them together only seem to result in "Error 42" (LabVIEW: Generic Error) from the POST vi, rather than returning the headers and body text.

I have also tried using DOTNET calls and was at least able to get the login page returned but could not seem to trigger the login.

I switched to the HTTP Client VIs because they offered an alternate hope and I could at least see where to attach a cookie file with them (though a cookie file may not be the same as reserving space for a session cookie).

Any guidance would be appreciated!

You are connecting to an SSL address (https) but not configuring the internet session to use SSL.

Put a "ConfigSSL.vi" after the open.

Untitled.png
A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. (Herm Albright 1876-1944).

Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!

#4 WMassey

WMassey

    Very Active

  • Members
  • PipPipPip
  • 216 posts

Posted 17 July 2012 - 08:44 PM

You might consider checking out libcurl. They have a C binding, so you should just be able to drop CLNs and go nuts with it. I have had excellent luck in the past using libcurl (via php) to automate HTTP/HTTPS transactions.

Thanks for the suggestion and link. If I cannot get LabVIEW bent to my will then I'll consider it.

You are connecting to an SSL address (https) but not configuring the internet session to use SSL.

Put a "ConfigSSL.vi" after the open.

Untitled.png

Thank you! That did seem to help! I had tried using it (ConfigSSL.vi) at one time with this test code but had no luck and got scared away from it by all the inputs to the VI that I did not know how to use. After your suggestion I tried it again. My first try again yielded the error #42 but then I saw that the VI had a default-True boolean input telling it to check/use all those other inputs. I set the "verify server" input to false and the error went away and, based on the redirection and cookie I'm seeing, it appears like the login worked!

Thank you!

#5 ShaunR

ShaunR

    LabVIEW Archetype

  • Members
  • PipPipPipPipPipPip
  • 2,224 posts
  • Version:LabVIEW 2009
  • Since:1994

Posted 17 July 2012 - 09:02 PM

Thanks for the suggestion and link. If I cannot get LabVIEW bent to my will then I'll consider it.


Thank you! That did seem to help! I had tried using it (ConfigSSL.vi) at one time with this test code but had no luck and got scared away from it by all the inputs to the VI that I did not know how to use. After your suggestion I tried it again. My first try again yielded the error #42 but then I saw that the VI had a default-True boolean input telling it to check/use all those other inputs. I set the "verify server" input to false and the error went away and, based on the redirection and cookie I'm seeing, it appears like the login worked!

Thank you!

Yeah. If you are behind a natted router it will fail (as it cannot do a reverse DNS lookup to verify the server). But you've figured it out.
A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. (Herm Albright 1876-1944).

Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!





Also tagged with one or more of these keywords: https, dotnet, client, login, cookie