本文整理汇总了C#中ResizeSettings.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# ResizeSettings.Normalize方法的具体用法?C# ResizeSettings.Normalize怎么用?C# ResizeSettings.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResizeSettings
的用法示例。
在下文中一共展示了ResizeSettings.Normalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pipeline_ImageMissing
void Pipeline_ImageMissing(System.Web.IHttpModule sender, System.Web.HttpContext context, Configuration.IUrlEventArgs e)
{
if (!string.IsNullOrEmpty(e.QueryString["404"])) {
//Resolve the path to virtual or app-relative for
string path = resolve404Path(e.QueryString["404"]);
//Resolve to virtual path
path = Util.PathUtils.ResolveAppRelative(path);
//Merge commands from the 404 querystring with ones from the original image.
ResizeSettings imageQuery = new ResizeSettings(e.QueryString);
imageQuery.Normalize();
imageQuery.Remove("404"); //Remove the 404 ref
ResizeSettings i404Query = new ResizeSettings(Util.PathUtils.ParseQueryString(path));
i404Query.Normalize();
//Overwrite new with old
foreach (string key in i404Query.Keys)
if (key != null) imageQuery[key] = i404Query[key];
path = PathUtils.AddQueryString(PathUtils.RemoveQueryString(path), PathUtils.BuildQueryString(imageQuery));
//Redirect
context.Response.Redirect(path, true);
}
}
示例2: Pipeline_ImageMissing
void Pipeline_ImageMissing(System.Web.IHttpModule sender, System.Web.HttpContext context, Configuration.IUrlEventArgs e) {
if (!string.IsNullOrEmpty(e.QueryString["404"])) {
//Resolve the path to virtual or app-relative for
string path = resolve404Path(e.QueryString["404"]);
//Resolve to virtual path
path = Util.PathUtils.ResolveAppRelative(path);
// Merge commands from the 404 querystring with ones from the
// original image. We start by sanitizing the querystring from
// the image.
ResizeSettings imageQuery = new ResizeSettings(e.QueryString);
imageQuery.Normalize();
// Use the configured settings by default.
var filterMode = this.filterMode;
var except = this.except;
// To support querystring-specifiable filter mode and exceptions,
// uncomment the if block below.
////// If the imageQuery includes specific 404 command-filtering,
////// (*either* of the values), use those instead of the
////// configured defaults.
////if (!string.IsNullOrEmpty(e.QueryString["404.filterMode"]) ||
//// !string.IsNullOrEmpty(e.QueryString["404.except"]))
////{
//// filterMode = NameValueCollectionExtensions.Get(e.QueryString, "404.filterMode", FilterMode.ExcludeUnknownCommands);
//// except = MatcherCollection.Parse(e.QueryString["404.except"]);
////}
// remove all of the commands we're supposed to remove... we
// clone the list of keys so that we're not modifying the collection
// while we enumerate it.
var shouldRemove = CreateRemovalMatcher(filterMode, except);
var names = new List<string>(imageQuery.AllKeys);
foreach (var name in names)
{
if (shouldRemove(name, imageQuery[name]))
{
imageQuery.Remove(name);
}
}
// Always remove the '404', '404.filterMode', and '404.except' settings.
imageQuery.Remove("404");
imageQuery.Remove("404.filterMode");
imageQuery.Remove("404.except");
ResizeSettings i404Query = new ResizeSettings(Util.PathUtils.ParseQueryString(path));
i404Query.Normalize();
//Overwrite new with old
foreach (string key in i404Query.Keys)
if (key != null) imageQuery[key] = i404Query[key];
path = PathUtils.AddQueryString(PathUtils.RemoveQueryString(path), PathUtils.BuildQueryString(imageQuery));
//Redirect
context.Response.Redirect(path, true);
}
}