public static IList <string> GetOCRNotRequiredFileExtentions() { IList <string> lstOCRNotRequiredFileExt = null; string XmlPath = string.Empty; try { XmlPath = "OCRNotRequiredFileExt".GetConfigKeyValue(); if (!string.IsNullOrEmpty(XmlPath) && File.Exists(XmlPath)) { XmlDocument objXmlDocument = new XmlDocument(); XmlNodeList childNodes = null; objXmlDocument.Load(XmlPath); childNodes = objXmlDocument.DocumentElement.ChildNodes; lstOCRNotRequiredFileExt = new List <string>(); for (int i = 0; i < childNodes.Count; i++) { lstOCRNotRequiredFileExt.Add(childNodes[i].InnerText); } } } catch (Exception ex) { AggieGlobalLogManager.Warn(ex, "Failed to get extensions for which OCR is not required!"); } return(lstOCRNotRequiredFileExt); }
public override void OnAuthorization(HttpActionContext actionContext) { if (actionContext != null) { var query = Utility.GetQueryParameters(actionContext.ControllerContext.Request.RequestUri.Query); if (!(query.ContainsKey("key") && query["key"].ToLower().Equals("blindman"))) { actionContext.Response = actionContext.Response ?? new HttpResponseMessage(); actionContext.Response.StatusCode = HttpStatusCode.Unauthorized; AggieGlobalLogManager.Warn("Admin Authorization failed"); } } }
public override void OnException(HttpActionExecutedContext context) { if (context.Exception != null && !(context.Exception is WebApiException)) { AggieGlobalLogManager.Fatal(context.Exception, "Exception handled in MVC-Controller, Request URI:{0}", context.Request.RequestUri); } else { AggieGlobalLogManager.Warn(context.Exception, "Exception handled in MVC-Controller, Request URI:{0}", context.Request.RequestUri); } var response = new HttpResponseMessage(); // { ReasonPhrase = context.Exception == null ? string.Empty : context.Exception.Message }; // No nead to write reason phrase as no one needs it now var exception = context.Exception as WebApiException; response.StatusCode = exception != null ? exception.Status : HttpStatusCode.InternalServerError; //if(exception != null && exception.Error== ErrorList.PasswordExpired) // response.Content = new ErrorObject(exception != null ? exception.Error : ErrorList.UnknownException, exception.Message).ToContent(); //else response.Content = new ErrorObject(exception != null ? exception.Error : ErrorList.UnknownException).ToContent(); context.Response = response; }