LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling username/pwd from a website using CVI

I am connecting to an embedded web server which needs username/pwd.
The device uses basic authentication. I know that I need to send an
authentication header to the device with username:pwd encoded in base64.
How can I send the authentication header from my CVI program?

I am using DataSockets to get the HTML, like

DS_Open("http://mydeviceIPAddress");

This works if no authentication is used by the web server, but I am lost
in case web server requires the authentication.

I looked into the CVI Inet kit, it doesn't have any controls to help
with it.


vishi
0 Kudos
Message 1 of 3
(2,802 Views)
CVI does not have any functions for the base64 encoding, but site talks about how you would do this. The actaul encoding class doesnt use MFC, so you should be able to get it to work.
Once you get the base64 string, you should be able to add it on the basic connection url with the following format

http://:@/

If you do get this to work, let me know, I havnt really tried this myself.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(2,802 Views)
Thanks Bilal,

I tried it and it didn't work, atleast not when I tried
http://user:pwd@host/. For now I have the base64 encoded values of the
username/pwd (as these are not changing in my case), I just need to
figure out how to send this autorization header.

The article you referred mentions some RFCs along with some sample code,
I will go through them.


vishi

bilalD wrote:
> CVI does not have any functions for the base64 encoding, but
> href="http://www.pocketpcdn.com/articles/http.html">site
talks
> about how you would do this. The actaul encoding class doesnt use MFC,
> so you should be able to get it to work.
> Once you get the base64 string, you should be able to add it on the
> basic connection url with the following format
>
> http://<
User>:@/
>
> If you do get this to work, let me know, I havnt really tried this
> myself.
>
> Hope this helps
>
> Bilal Durrani
> NI
0 Kudos
Message 3 of 3
(2,802 Views)