When creating a workflow which uses Windows Authentication it is impossible to retrieve the current user (Get Current User-component) when debugging the workflow.
Each time you need to debug the workflow you have to disable the Get Current User-component and put a fixed result in there.
I have created an additional component to overcome enabling and disabling the get current user-component when debugging and publishing the application.
This is an overview of a simple workflow. It uses Get Port Number (Code (Script) Component) to retrieve the port number from which the workflow is being accessed. In non-debug situation it is most likely port 80 (HTTP) or 443 (HTTPS). Debug sessions always run at a random port number above 1024.
If it is port number 80 then we go to the Get Current User-component. If it is a different port number then we put a static value (Add Data Element-component)
Here follow the steps to recreate this workflow
Step 1: Locate the Code (Script) Component. This component is included in library LogicBase.Components.Scripting.dll
Step 2: Drag it into your workflow and edit it.
Step 3: Leave the Input Parameters empty and click Next
Step 4: Configure Result variable with type "Number (integer)" and a variable name (eg. iPort)
Step 5: Configure namespaces
System System.Web
As source code enter
return HttpContext.Current.Request.Url.Port;
Step 6: Just click Finish.
REMARK: Run test will generate an error.
Step 7: Add a compare number component. And Compare the result with port 80 (HTTP)
Step 8: Add Get Current User component after path equal to
Step 9: Add new data element component after paths less than and greater than
Step 10: When running the workflow the current user will result in value DEBUG.
Running it in production it will give the actual user name.