Hello,
I am trying to create any variable from a web page to pass this variable to the DataLogger. With the commands that appear, it does let me read data (from a table for example) but it does not let me write. I understand that the error has to do with security but I don't know how to change it.
The code I am using is:
Dim Commands As String * 200
Public Temp_CR6
DataTable (Table1,True,-1)
DataInterval (0,1,Min,10)
Sample (1,Temp_CR6,FP2)
EndTable
WebPageBegin("default.html",Commands)
HTTPOut("<!DOCTYPE HTML PUBLIC " + CHR(34) + "-//W3C//DTD HTML 4.0 Transitional//EN" + CHR(34)+ ">") (HTTPOut("<HTML>") HTTPOut("<HEAD>")
HTTPOut("<TITLE>CR6</TITLE>")
HTTPOut("</HEAD>") HTTPOut("<BODY>")
HTTPOut("<ul><li><a href="+ CHR(34) + "command=NewestRecord&table=Table1"+ CHR(34) + ">Newest Record from Table1</a></li></ul>")
HTTPOut("<h2> Set Variable on Public:<a href=" + CHR(34) + "command=SetValue&table=Public&field=Variable_test&value=10" + CHR(34) + ">Set_Variable</a><h2>")
HTTPOut("</BODY>")
HTTPOut("</HTML>")
WebPageEnd
BeginProg
Scan (1,Sec,3,0)
PanelTemp (Temp_CR6,15000)
CallTable (Table1)
NextScan
EndProg
The command "command=NewestRecord&table=Table1" is executed without problems from the page it creates, I can see the variable Temp_CR6.
The command "command=SetValue&table=Public&field=Variable_test&value=10" that should create a variable called "Variable_test" and put it in the table "Public" with a value of 10 gives me error. When I click on the link it creates, I get the following:
Forbidden
Authentication failure. You don't have permission to access this file/command.
Please, can someone help me?
Default page access is read only. The datalogger needs a .csipasswd file configured to create a user with read/write permission. The api call will need to use the username and password to write the value.
Thank you very much for your answer, could you tell me exactly how to create this .csipasswd file? In the help provided by "Web Server/API Commands" ,it says that you must edit the parameter "HTTP Passwords button" from the "Device Configuration Utility", but I don't see anything like that. I have Loggernet 4.7 and Device Configuration Utility 2.26.
Thanks in advance!
You are here: CRBasic Programming > Web Server/API Commands
The encrypted password file is created (or an existing password file is modified) using Device Configuration Utility. Support for this file was added in Device Configuration Utility version 1.17. It is created from the Net Services tab, Edit HTTP Passwords button. After user accounts are defined and the Apply button is pressed, the .csipasswd file is automatically saved to the datalogger’s CPU drive. When a .csipasswd file enables basic access authentication, the datalogger's PakBus/TCP Password security setting is not used when accessing the datalogger via HTTP.
CRbasic Editor 3.7 (LN4.5), CR1000X loaded
Thank you very much!