It took me three days to solve it, nearly give up, and thanks for the final article: http://stackoverflow.com/questions/25460798/how-to-ignore-some-route-while-using-asp-net-friendly-urls/25499902#25499902 ----------------------------------------------------------------------------- Project: Visual Studio Community 2013 + ASP.NET Web Application (Framework 4.5.2) Error Code: 204 Error Message: en: The uploaded file is corrupt zh-cn: 上传文件已损失 zh-tw: 您上傳的檔案已經損毀 Reason: FriendlyUrls (a new ASP.NET feature) Solution: Excluding the folder of ckfinder from the FriendlyUrls' machanism Custom a WebFormsFriendlyUrlResolver: ----------------------------part 1------------------------------------------- public class MyWebFormsFriendlyUrlResolver : Microsoft.AspNet.FriendlyUrls.Resolvers.WebFormsFriendlyUrlResolver { /// /// 把ckfinder文件夹从FriendlyUrl机制中排除掉,防止出现The uploaded file is corrupt错误 /// /// /// public override string ConvertToFriendlyUrl(string path) { if (!string.IsNullOrEmpty(path)) { if (path.ToLower().Contains("/editor/ckfinder")) { // Here the filter code return path; } } return base.ConvertToFriendlyUrl(path); } } ----------------------------------------------------------------------------- Location: /App_Start/RouteConfig.cs ----------------------------part 2------------------------------------------- public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings, new Microsoft.AspNet.FriendlyUrls.Resolvers.IFriendlyUrlResolver[] {new MyWebFormsFriendlyUrlResolver() }); } -----------------------------------------------------------------------------
Thu, 02/05/2015 - 07:25
#1