private void CreateSession(LogOn.FormInfo formInfo) { string str; string applicationName; string str1; string originalString; WSManConnectionInfo wSManConnectionInfo = null; if (formInfo.ConfigurationName.Length == 0) { str = null; } else { str = string.Concat("http://schemas.microsoft.com/powershell/", formInfo.ConfigurationName); } string str2 = str; PSCredential pSCredential = new PSCredential(formInfo.DestinationUserName, formInfo.DestinationPassword); if (!formInfo.IsUriConnection) { if (string.Compare(formInfo.ApplicationName, "WSMAN", StringComparison.OrdinalIgnoreCase) == 0) { applicationName = null; } else { applicationName = formInfo.ApplicationName; } string str3 = applicationName; try { wSManConnectionInfo = new WSManConnectionInfo(formInfo.UseSsl, formInfo.ComputerName, formInfo.Port, str3, str2, pSCredential); } catch (UriFormatException uriFormatException) { throw PowwaException.CreateValidationErrorException(Resources.LogonError_InvalidComputerNameUriFormat); } wSManConnectionInfo.AuthenticationMechanism = formInfo.AuthenticationType; PowwaEvents.PowwaEVENT_DEBUG_CONNECT_USING_COMPUTERNAME(formInfo.DestinationUserName, wSManConnectionInfo.ComputerName, wSManConnectionInfo.Port, wSManConnectionInfo.AppName, wSManConnectionInfo.ShellUri, wSManConnectionInfo.AuthenticationMechanism.ToString()); } else { wSManConnectionInfo = new WSManConnectionInfo(formInfo.ConnectionUri, str2, pSCredential); if (!formInfo.AllowRedirection) { wSManConnectionInfo.MaximumConnectionRedirectionCount = 0; } PowwaEvents.PowwaEVENT_DEBUG_CONNECT_USING_URI(formInfo.DestinationUserName, wSManConnectionInfo.ConnectionUri.AbsoluteUri, wSManConnectionInfo.ShellUri); } string sourceIPAddressRemoteAddr = SessionHelper.GetSourceIPAddressRemoteAddr(); string sourceIPAddressHttpXForwardedFor = SessionHelper.GetSourceIPAddressHttpXForwardedFor(); if (formInfo.IsUriConnection) { str1 = null; } else { str1 = PswaHelper.TranslateLocalComputerName(formInfo.ComputerName); } string str4 = str1; PowwaAuthorizationManager.Instance.CheckLogOnCredential(formInfo.UserName, formInfo.Password, str4, formInfo.ConnectionUri, formInfo.ConfigurationName, sourceIPAddressRemoteAddr, sourceIPAddressHttpXForwardedFor); ClientInfo clientInfo = new ClientInfo(HttpContext.Current.Request.UserAgent, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture); PowwaSession powwaSession = PowwaSessionManager.Instance.CreateSession(this.Session.SessionID, wSManConnectionInfo, clientInfo, formInfo.UserName); string name = powwaSession.Name; string userName = formInfo.UserName; string str5 = sourceIPAddressRemoteAddr; string str6 = sourceIPAddressHttpXForwardedFor; if (formInfo.IsUriConnection) { originalString = wSManConnectionInfo.ConnectionUri.OriginalString; } else { originalString = wSManConnectionInfo.ComputerName; } PowwaEvents.PowwaEVENT_SESSION_START(name, userName, str5, str6, originalString, formInfo.DestinationUserName, wSManConnectionInfo.Port, wSManConnectionInfo.AppName, wSManConnectionInfo.ShellUri); HttpCookie item = base.Request.Cookies["ASP.NET_SessionId"]; if (FormsAuthentication.RequireSSL && item != null) { item.Secure = true; } FormsAuthentication.SetAuthCookie(formInfo.UserName, false, "/"); base.Response.Redirect("~/default.aspx"); //FormsAuthentication.RedirectFromLoginPage(formInfo.UserName, false); }