private string GetDefaultUserId()
{
string retval = string.Empty;
// First, check to see if we have an HttpContext to work with
if(HttpContext.Current != null)
{
// If we have a current user, use that
if(!string.IsNullOrEmpty(HttpContext.Current.User.Identity.Name))
{
retval = HttpContext.Current.User.Identity.Name;
}
else if(HttpContext.Current.Session != null)
{
// Otherwise, use sessionID
retval = HttpContext.Current.Session.SessionID ?? String.Empty;
}
}
// If not, we're SOL
return retval;
}