Loading...

All project content is available for reading, but you need to be a member of the project for Subversion checkout of source code, or to create/modify any information.
Login if you are a member. Apply here to request membership (open to all).

Ticket #351 (new enhancement)

Opened 4 years ago

Last modified 4 years ago

Move IgnoredResourceExtensions to web.config?

Reported by: thomas@… Owned by: permagne@…
Priority: minor Component: 404Handler
Keywords: Cc: fmsftst@…

Description

We have a lot of requests to http://mypage.no/resorce.jpg.img, and I want to add ".img" to the ignoredResourceExtensions (wich is a private, static, readonly List<string>. Can this be moved to configuration?

Solution-suggestion:

  • add IgnoredResourceExtensions to configurationsection (via configuration section designer, as a simple comma-seperated string)
  • minor changes in Custom404Handler to check if IgnoredResourceExtensions is set in web.config, if not, default values are used

BVNetwork.FileNotFound?.Configuration.Configuration
and BVNetwork.FileNotFound.Handler.CustomFileNotFoundHandler:

private static readonly List<string> DEF_IGNOREDRESOURCEEXTENSIONS = new List<string>() { "jpg", "gif", "png", "css", "js", "ico", "swf" };
/// <summary>

/// Returns a list of ignored resource extensions. Default values if nothing is specified in web.config: "jpg,gif,png,css,js,ico,swf"

/// </summary>

public static List<string> IgnoredResourceExtensions

{

    get

    {

        if (Bvn404HandlerConfiguration.Instance != null && !string.IsNullOrEmpty(Bvn404HandlerConfiguration.Instance.IgnoredResourceExtensions))

        {

            var temp = Bvn404HandlerConfiguration.Instance.IgnoredResourceExtensions.Split(",".ToCharArray()).ToList();

            return temp;

        }

        return DEF_IGNOREDRESOURCEEXTENSIONS;

    }

}
//private static readonly List<string> _ignoredResourceExtensions = new List<string> {"jpg", "gif", "png", "css", "js", "ico", "swf"};
private static List<string> _ignoredResourceExtensions; 

public static List<string> IgnoredResourceExtensions
{
	get { return _ignoredResourceExtensions ?? (_ignoredResourceExtensions = Configuration.Configuration.IgnoredResourceExtensions); }
}

Change History

comment:1 Changed 4 years ago by thomas@…

If you want, I can commit the changes above to the 6.x-branch? 

comment:2 Changed 4 years ago by permagne@…

Sure. Sounds reasonable.

Note: See HelpUser/Tickets for help on using tickets.