Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 71087, Entry date: 07/29/2019

How do you implement interactive login/logout in WinCC V7, PCS 7 OS and WinCC Professional?

  • Entry
  • Associated product(s)
Login/logout of users to the user interface varies depending on the runtime environment. Possible solutions are shown in the following.

1. WinCC Runtime

Configure the following C actions in a screen in combination with different buttons.


Action for Login (for "mouse-click" event, for example):
#pragma code ("useadmin.dll")
#include "PWRT_api.h"
#pragma code()
Action for Logout (for "mouse-click" event, for example):
#pragma code ("useadmin.dll")
#include "PWRT_api.h"
#pragma code()

The parameter for PWRTLogin must be a CHAR character.
It specifies on which monitor the dialog is displayed.
If you are only using one screen, then you can leave the default parameter "1".  

You can also use the function PASSLoginDialog instead of the functions PWRTLogin or PWRTLogout.
This function requires the same parameters as the PWRTLogin function.
The functions PWRTLogin and PASSLoginDialog call the login mask, where you can log in or log out.
The function PWRTLogout is executed directly and does not call the login mask.

Both functions return "1" if they are executed correctly.
However, the login does not wait to see if the dialog is really displayed.

If you are using more than one monitor, you need WinCC Basic Process Control(OS Project Editor), so that the Login dialog is displayed on the appropriate monitor.
You can also specify a monitor number without Basic Process Control, but the Login dialog then always appears on the first monitor.

2. WinCC WebNavigator

2.1 Internet Explorer

Here the login window is displayed automatically after input of the address of the WebNavigator server computer in the Internet Explorer.

In WinCC V7.2 and higher and WinCC Runtime Professional V12.0 and higher the PWRTLogout function is also supported by the WebNavigator in the same way as in WinCC Runtime.
In this way a change of user can be made without having to close the interface.

The PWRTLogout function is executed directly and informs the user about the logout.
If you click on the "Login" button displayed in this window, the login window opens again.

C script login functions are not supported by the WebNavigator.
To prevent an error message occurring in the WebNavigator with these commands, they have to be disabled with the query "#ifndef RUN_ON_WEBNAVIGATOR" in the WebNavigator.
An example is described in the manual for orientation:
Using Scripts V7.5
Using Scripts V15.1

2.1 WinCCViewerRT

If the authorization for a specific user is stored in the WinCCViewerRT with user name and password, that user remains logged in permanently.
If the PWRTLogout functions is to be used in the WinCCViewerRT, the User and Password fields must be deleted in the "WinCCViewerRT" configuration dialog or remain unfilled.

The "WinCCViewerRT" configuration dialog is called via a previously defined key combination.
More information is available in the manual:
Operating the WinCC Project using WinCCViewerRT V7.5
Operating the WinCC Project using WinCCViewerRT V15.1

3. WinCC WebUX (WinCC V7.3 and higher, PCS 7 V8.1 and WinCC Professional V14)

Also in WebUX the login window is displayed automatically after input of the server address.

Generally WebUX does not support C script actions. This means that C code is not run in the browser.

It is possible to change users directly by refreshing the page (with key F5 in the Internet Explorer, for example) if the option "Keep me logged on" is not checked for "WebUX Login" (WinCC V7.4 SP1, PCS 7 V9.0 and WinCC Professional V14.0 SP1 and higher).
If the option "Keep me logged on" is checked, that user remains logged in for the URL called here (for example, https://<Servername> or https://localhost).

If the user is to be changed in this case, you have to delete the browser cache beforehand in order to disable the "Keep me logged on" option.
For example, in the Internet Explorer via: Internet Options > General > Browsing History > Delete > Cookies and Website Data.

Additional Keywords
Programming note, Login, Logon, Logoff, Logout, Change user, Reload the page

Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.