public static void StampToHttpHeaders(WinRMInfo winRMInfo, NameValueCollection httpHeaders) { httpHeaders["X-RemotePs-Action"] = winRMInfo.Action; httpHeaders["X-RemotePs-RawAction"] = winRMInfo.RawAction; httpHeaders["X-RemotePs-SessionId"] = winRMInfo.SessionId; httpHeaders["X-RemotePs-ShellId"] = winRMInfo.ShellId; httpHeaders["X-RemotePs-CommandId"] = winRMInfo.CommandId; httpHeaders["X-RemotePs-CommandName"] = winRMInfo.CommandName; httpHeaders["X-RemotePs-SignalCode"] = winRMInfo.SignalCode; }
public static void SetWSManFailureCategory(NameValueCollection httpHeaders, string wsmanFaultMessage) { if (string.IsNullOrEmpty(wsmanFaultMessage) || wsmanFaultMessage.Contains("FailureCategory")) { return; } string fcSubInfo = "Others"; string text = WinRMInfo.knownWSManError.Keys.FirstOrDefault((string key) => wsmanFaultMessage.Contains(key)); if (!string.IsNullOrEmpty(text)) { fcSubInfo = WinRMInfo.knownWSManError[text]; } WinRMInfo.SetFailureCategoryInfo(httpHeaders, FailureCategory.WSMan, fcSubInfo); }
public static WinRMInfo GetWinRMInfoFromHttpHeaders(NameValueCollection httpHeaders) { WinRMInfo winRMInfo = null; if (httpHeaders != null) { winRMInfo = new WinRMInfo(); winRMInfo.Action = httpHeaders["X-RemotePs-Action"]; winRMInfo.RawAction = httpHeaders["X-RemotePs-RawAction"]; winRMInfo.SessionId = httpHeaders["X-RemotePs-SessionId"]; winRMInfo.ShellId = httpHeaders["X-RemotePs-ShellId"]; winRMInfo.CommandId = httpHeaders["X-RemotePs-CommandId"]; winRMInfo.CommandName = httpHeaders["X-RemotePs-CommandName"]; winRMInfo.SignalCode = httpHeaders["X-RemotePs-SignalCode"]; } return(winRMInfo); }