The Preconnect method is a simple method that is called if there is no PreConnectEx method defined...generally, PreConnectEx provides far more functionality but if your needs are simple, PreConnect can be implemented.
/// <summary>
/// PreConnect is used to manage details of a new connection. Especially useful if Windows Security and Active Directory are in play.
/// </summary>
/// <param name="context">Active HTTP Request- can use User.Identity to get WindowsIdentity</param>
/// <param name="hostName">Host name that will be connected to--can change</param>
/// <param name="luName">LUName or pattern to be used--can change</param>
/// <param name="locationAddress">The location IP address to be passed--can be changed</param>
/// <returns>true to continue, false to cancel connection</returns>
static public bool PreConnect(HttpContext context, ref string hostName, ref string luName, ref string locationAddress)
{
luName = "Logger15";
return true;
}
In the above example, the luName / deviceName that the user will connect with is hardcoded--but you can derive the user's Windows ID from the context (or use the IP address) to determine the LUName in a more dynamic manner.