User Id is one of the security related system attributes that are used to identify a user session in a web environment. Depending on user security setup and application design there may be different ways to populate those system attributes. The user id in a .Net application could be the same as the Windows logon user, but it could also be different. Therefore Gen .Net runtime lets the user decide how they want their system attributes to be populated. For this purpose Gen provides a user exit to do that job.
Basically, you need to modify the UserID property of the SessionIdExit.cs to populate the user ID for a .Net application.
Following is an example of how to populate the .Net app user id with Windows logon user id.
- In IIS, open the properties window of the default web site.
- On the Directory Security tab, click on the Edit button for Anonymous access and authentication control.
- Deselect the "Anonymous Access" and check the "Integrated Windows authentication."
- In the web.config file, which is located in inetpub wwwroot <app dir>, add following entry:
<authentication mode=Windows />
Note: You may want to first stop the ASP.Net state service and WWW publishing services in Windows Services before doing this.
- Go to <Gen Dir>\.net\exits\src\amrt and modify the SessionIdExit.cs as follows:
Add a "using" at the top of the file:
Modify the UserId property as follows:
public static string UserId
int index = currentUser.IndexOf('\\');
This will return the user id portion given that the Windows user id is in format <domain>@<user id>
- Create the exit assembly by calling makeexits.bat in the Gen\.Net\exits directory. This will create a new CA.AllFusionGen.exits.dll. Replace the same dll in the application bin directory of the deployed .net application with this one and retry the trace.