Skip to content

Instantly share code, notes, and snippets.

@stand-sure
Last active December 5, 2016 23:08
Show Gist options
  • Save stand-sure/24338388a4f3617e9eaf6c7fd48fa970 to your computer and use it in GitHub Desktop.
Save stand-sure/24338388a4f3617e9eaf6c7fd48fa970 to your computer and use it in GitHub Desktop.
/// <summary>
/// Sets the session identifier if not previously set.
/// </summary>
/// <param name="context">Context.</param>
/// <param name="sid">Sid.</param>
static void SetSessionIdIfNotPreviouslySet(HttpContextBase context,
string sid)
{
SetCookie(context, "sid",
string.IsNullOrEmpty(sid) ? Guid.NewGuid().ToString() : sid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment