internal static WLCDPartnerAccessException WrapIfKnownSoapException(SoapException se) { if (se == null) { throw new ArgumentNullException("SoapException should never be null."); } WLCDPartnerAccessException result = null; LocalizedString message = LocalizedString.Empty; string innerText; if (se.Detail != null && se.Detail.HasChildNodes && (innerText = se.Detail.FirstChild.InnerText) != null) { if (!(innerText == "1001")) { if (!(innerText == "1002")) { if (!(innerText == "1003")) { if (!(innerText == "1004")) { if (innerText == "1005") { message = Strings.ErrorInvalidManagementCertificate(se.ToString()); result = new WLCDPartnerAccessException(message, se); } } else { message = Strings.ErrorMemberNotAuthorized(se.ToString()); result = new WLCDPartnerAccessException(message, se); } } else { message = Strings.ErrorPartnerNotAuthorized(se.ToString()); result = new WLCDPartnerAccessException(message, se); } } else { message = Strings.ErrorInvalidPartnerCert(se.ToString(), "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\ExchangeWlcd\\"); result = new WLCDPartnerAccessException(message, se); } } else { message = Strings.ErrorInvalidPartnerSpecified(se.ToString(), "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\ExchangeWlcd\\"); result = new WLCDPartnerAccessException(message, se); } } return(result); }
private static void OnEnter(object source, EventArgs eventArgs) { var app = (HttpApplication)source; var context = app.Context; var httpStream = context.Request.InputStream; // Save the current position of stream. var posStream = httpStream.Position; // If the request contains an HTTP_SOAPACTION // header, look at this message. if (context.Request.ServerVariables["HTTP_SOAPACTION"] == null) { return; } // Load the body of the HTTP message // into an XML document. var dom = new XmlDocument(); var soapUser = String.Empty; var soapPassword = String.Empty; try { dom.Load(httpStream); // Reset the stream position. httpStream.Position = posStream; // Bind to the Authentication header. soapUser = dom.GetElementsByTagName("User")?.Item(0)?.InnerText; soapPassword = dom.GetElementsByTagName("Password")?.Item(0)?.InnerText; } catch (Exception e) { // Reset the position of stream. httpStream.Position = posStream; // Throw a SOAP exception. var name = new XmlQualifiedName("Load"); var soapException = new SoapException("Unable to read SOAP request", name, e); Logging.Error(soapException.ToString()); throw soapException; } // Raise the custom global.asax event. OnAuthenticate(new WebServiceAuthenticationEvent(context, soapUser, soapPassword)); }
public void SetSoapFaultException(WSOperation operation, SoapException soapEx, WSDescriberForReport WSItemVulnerabilities, bool isDebug) { if (WSItemVulnerabilities.Vulns.Where(v => v.VulnerableMethodName.Equals(operation.MethodName) && v.Vuln.id == 7).Count() <= 0) // aynı method için sadece 1 tane soap fault zafiyeti yaz { mainForm.Log(" Soap Exception: " + soapEx.ToString(), FontStyle.Regular, isDebug, false); VulnerabilityForReport soapFaultVuln = new VulnerabilityForReport(); soapFaultVuln.Vuln = MainForm.vulnerabilities.Vulnerability.Where(v => v.id == 7).FirstOrDefault(); soapFaultVuln.VulnerableMethodName = operation.MethodName; soapFaultVuln.VulnerableParamName = ""; soapFaultVuln.Payload = ""; soapFaultVuln.Response = soapEx.Message; soapFaultVuln.StatusCode = ""; WSItemVulnerabilities.Vulns.Add(soapFaultVuln); } }
internal static WLCDPartnerAccessException GetWLCDPartnerAccessExceptionToThrow(string url, SoapException se) { if (se == null) { throw new ArgumentNullException("se"); } WLCDPartnerAccessException ex = DomainServicesHelper.WrapIfKnownSoapException(se); if (ex == null) { LocalizedString message = Strings.ErrorWLCDPartnerAccessException(url, se.ToString()); ex = new WLCDPartnerAccessException(message, se); } return(ex); }
public static void GetExceptionString(Exception ex, out string detailedText) { detailedText = null; if (ex != null) { if (ex is SoapException) { SoapException soap = ex as SoapException; detailedText = string.Format("Message:\n {0} \n\n StackTrace:\n {1} \n\n Detail:\n {2}", soap.Message, soap.ToString(), soap.Detail.InnerText); } else if (ex is SqlException) { SqlException sql = ex as SqlException; detailedText = string.Format("Message:\n {0} \n\n StackTrace:\n {1} \n\n SqlErrors:\n {2}", sql.Message, sql.ToString(), sql.Errors.Count); } else { detailedText = string.Format("Message:\n {0} \n\n StackTrace:\n {1}", ex.Message, ex.ToString()); } } }