Exemple #1
0
 private void Application_BeginRequest(object source, EventArgs e)
 {
     try {
         // Con Ajax Control Toolkit tengo que incluir la condición !HttpContext.Current.Request.QueryString.ToString().Contains("_TSM_HiddenField")
         // En ciertos casos, como con el AutoComplete, llama a la página actual con otros parámetros y el filtro falla
         if (ConfigurationManager.AppSettings[S_CONFIG_EXTENSIONESATRATARPORMODULOS].Contains(Path.GetExtension(HttpContext.Current.Request.CurrentExecutionFilePath)) && !HttpContext.Current.Request.QueryString.ToString().Contains("_TSM_HiddenField"))
         {
             HttpApplication app = source as HttpApplication;
             if (app != null)
             {
                 bool     _excepcion       = false;
                 string[] _urlsExcepciones = (!string.IsNullOrEmpty(ConfigurationManager.AppSettings[S_CONFIG_EXCEPCIONES]) ? ConfigurationManager.AppSettings[S_CONFIG_EXCEPCIONES].Split(',') : null);
                 if (_urlsExcepciones != null)
                 {
                     _excepcion = _urlsExcepciones.Any(u => app.Request.RawUrl.ToLower().Contains(u.ToLower()));
                 }
                 if (!_excepcion && app.Request != null && app.Request.Form["__EVENTTARGET"] != null && app.Request.Form["__EVENTTARGET"].Contains("crViewer"))
                 {
                     _excepcion = true;
                 }
                 if (!_excepcion)
                 {
                     _replacementDelegate = new FilterReplacementDelegate(FilterString);
                     _filterStream        = new InsertionFilterStream(app.Response.Filter, _replacementDelegate, app.Response.ContentEncoding);
                     app.Response.Filter  = _filterStream;
                     AsignarInformacionDominio(app);
                 }
             }
         }
     } catch { }
 }
 public InsertionFilterStream(Stream originalStream, FilterReplacementDelegate replacementFunction, Encoding encoding)
 {
     _originalStream      = originalStream;
     _replacementFunction = replacementFunction;
     _encoding            = encoding;
 }