/// <summary> /// Converts any urls in the input to absolute using the base directory of the include virtual path. /// </summary> /// <param name="includedVirtualPath">The virtual path that was included in the bundle for this item that is being transformed</param> /// <param name="input"></param> /// <example> /// bundle.Include("~/content/some.css") will transform url(images/1.jpg) => url(/content/images/1.jpg) /// </example> public string Process(string includedVirtualPath, string input) { if (includedVirtualPath == null) { throw new ArgumentNullException("includedVirtualPath"); } // Strip off the ~ that always occurs in app relative virtual paths string baseUrl = VirtualPathUtility.GetDirectory(includedVirtualPath.Substring(1)); return(ConvertUrlsToAbsolute(baseUrl, input)); }
/// <summary> /// 获取视图处理程序 /// </summary> /// <param name="virtualPath">视图的虚拟路径</param> /// <param name="includeDefaultHandler">是否要查找默认视图处理程序</param> /// <returns>该虚拟路径的视图处理程序</returns> internal static IViewHandler GetViewHandlerInternal(string virtualPath, bool includeDefaultHandler) { var handler = GetHandlerInternal(virtualPath); if (handler == null && !includeDefaultHandler) { handler = GetHandlerInternal(VirtualPathUtility.Combine(VirtualPathUtility.GetDirectory(virtualPath), "_handler.ashx")); } return(handler ?? new ViewHandler()); }
public static string GetTextPath(out string fileName) { string rootPath = HttpContext.Current.Server.MapPath(VirtualPathUtility.GetDirectory("~")); string filePath = string.Format(@"{0}Scripts\timeline\data\", rootPath); DeleteFiles(filePath); fileName = DateTime.Now.ToString("yyyyMMddHHmmss"); string path = string.Format(@"{0}Scripts\timeline\data\{1}.txt", rootPath, fileName); return(path); }
public BuildManagerDirectoryBuilder(VirtualPath virtualPath) { if (virtualPath == null) { throw new ArgumentNullException("virtualPath"); } this.vpp = HostingEnvironment.VirtualPathProvider; this.virtualPath = virtualPath; this.virtualPathDirectory = VirtualPathUtility.GetDirectory(virtualPath.Absolute); }
public string Process(string includedVirtualPath, string input) { if (includedVirtualPath == null) { throw new ArgumentNullException("includedVirtualPath"); } var directory = VirtualPathUtility.GetDirectory(includedVirtualPath); return(ConvertUrlsToAbsolute(directory, input)); //return new CssRewriteUrlTransform().Process("~" + VirtualPathUtility.ToAbsolute(includedVirtualPath), input); }
public void ContentService() { var provider = new TestContentService(); WebServiceLocator.RegisterService(provider, VirtualPathUtility.GetDirectory(testContentPath)); var result = HtmlServices.LoadContent(testContentPath); Assert.AreEqual(result.Content, testContent, "测试内容提供程序失败"); Assert.AreEqual(result.Provider, provider, "内容结果中的提供程序错误"); Assert.AreEqual(result.VirtualPath, testContentPath, "内容结果中的虚拟路径错误"); }
internal static WebPageRenderingBase GetStartPage( WebPageRenderingBase page, IVirtualPathFactory virtualPathFactory, string appDomainAppVirtualPath, string fileName, IEnumerable <string> supportedExtensions ) { // Build up a list of pages to execute, such as one of the following: // ~/somepage.cshtml // ~/_pageStart.cshtml --> ~/somepage.cshtml // ~/_pageStart.cshtml --> ~/sub/_pageStart.cshtml --> ~/sub/somepage.cshtml WebPageRenderingBase currentPage = page; var pageDirectory = VirtualPathUtility.GetDirectory(page.VirtualPath); // Start with the requested page's directory, find the init page, // and then traverse up the hierarchy to find init pages all the // way up to the root of the app. while ( !String.IsNullOrEmpty(pageDirectory) && pageDirectory != "/" && PathUtil.IsWithinAppRoot(appDomainAppVirtualPath, pageDirectory) ) { // Go through the list of supported extensions foreach (var extension in supportedExtensions) { var virtualPath = VirtualPathUtility.Combine( pageDirectory, fileName + "." + extension ); // Can we build a file from the current path? if (virtualPathFactory.Exists(virtualPath)) { var parentStartPage = virtualPathFactory.CreateInstance <StartPage>( virtualPath ); parentStartPage.VirtualPath = virtualPath; parentStartPage.ChildPage = currentPage; parentStartPage.VirtualPathFactory = virtualPathFactory; currentPage = parentStartPage; break; } } pageDirectory = currentPage.GetDirectory(pageDirectory); } // At this point 'currentPage' is the root-most StartPage (if there were // any StartPages at all) or it is the requested page itself. return(currentPage); }
public static MvcHtmlString RenderCssBundle(this HtmlHelper html, string bundlePath, BundleOptions options = BundleOptions.Minified, string media = null) { if (string.IsNullOrEmpty(bundlePath)) { return(MvcHtmlString.Empty); } if (!CachePaths()) { BundleCache.SafeClear(); } return(BundleCache.GetOrAdd(bundlePath, str => { var filePath = MapPath(bundlePath); var baseUrl = VirtualPathUtility.GetDirectory(bundlePath); if (options == BundleOptions.Combined) { return html.Css(bundlePath.Replace(".bundle", ""), media, options); } if (options == BundleOptions.MinifiedAndCombined) { return html.Css(bundlePath.Replace(".css.bundle", ".min.css"), media, options); } var cssFiles = File.ReadAllLines(filePath); var styles = new StringBuilder(); foreach (var file in cssFiles) { if (file.StartsWith("#")) { continue; } var cssFile = file.Trim() .Replace(".less", ".css") .Replace(".sass", ".css") .Replace(".scss", ".css") .Replace(".styl", ".css"); var cssSrc = Path.Combine(baseUrl, cssFile); styles.AppendLine( html.Css(cssSrc, media, options).ToString() ); } return styles.ToString().ToMvcHtmlString(); })); }
public static MvcHtmlString RenderCssBundle(this HtmlHelper html, string bundlePath, BundleOptions options = BundleOptions.Normal, string media = null) { if (string.IsNullOrEmpty(bundlePath)) { return(MvcHtmlString.Empty); } if (!CachePaths()) { BundleCache.SafeClear(); } return(BundleCache.GetOrAdd(bundlePath, str => { var filePath = HostingEnvironment.MapPath(bundlePath); var baseUrl = VirtualPathUtility.GetDirectory(bundlePath); if (options == BundleOptions.Combined) { return html.Css(bundlePath.Replace(".bundle", ""), media, options); } if (options == BundleOptions.MinifiedAndCombined) { return html.Css(bundlePath.Replace(".css.bundle", ".min.css"), media, options); } var cssFiles = File.ReadAllLines(filePath); //var urlPrefix = Helper.GetUrlPrefix(filterContext.HttpContext.Request.Url, WebConfigurationManager.AppSettings["RelativeUrl"]); var styles = new StringBuilder(); foreach (var file in cssFiles) { if (file.StartsWith("#")) { continue; } var cssFile = file.Trim() .Replace(".less", ".css") .Replace(".sass", ".css") .Replace(".scss", ".css") .Replace(".styl", ".css"); var cssSrc = Path.Combine(baseUrl, cssFile); styles.AppendLine( html.Css(cssSrc, media, options).ToString() ); } return styles.ToString().ToMvcHtmlString(); })); }
protected void Page_Load(object sender, EventArgs e) { configManager = new Config(Server.MapPath(VirtualPathUtility.GetDirectory(Request.Path))); if (configManager.getConfig("admin.password") == null) { Response.Redirect("setup.aspx"); Response.End(); } if (Request["SAVE_CONFIG"] != null) { String path_pdf = Request["PDF_Directory"]; String path_pdf_workingdir = Request["SWF_Directory"]; if (!path_pdf.EndsWith("\\")) { path_pdf += "\\"; } if (!path_pdf_workingdir.EndsWith("\\")) { path_pdf_workingdir += "\\"; } configManager.setConfig("path.pdf", path_pdf); configManager.setConfig("path.swf", path_pdf_workingdir); configManager.setConfig("licensekey", Request["LICENSEKEY"]); configManager.setConfig("splitmode", Request["SPLITMODE"]); configManager.setConfig("renderingorder.primary", Request["RenderingOrder_PRIM"]); configManager.setConfig("renderingorder.secondary", Request["RenderingOrder_SEC"]); configManager.SaveConfig(Server.MapPath(VirtualPathUtility.GetDirectory(Request.Path))); // wipe old converted files if (System.IO.Directory.Exists(configManager.getConfig("path.swf"))) { foreach (string filename in System.IO.Directory.GetFiles(configManager.getConfig("path.swf"))) { System.IO.File.Delete(filename); } } Response.Redirect("Default.aspx?msg=Configuration%20saved!"); } if (Session["FLEXPAPER_AUTH"] == null) { Response.Redirect("Default.aspx"); Response.End(); } }
void ImportSourceFile(string path) { // Get a full path to the source file, compile it to an assembly // add the depedency to the assembly // string baseVirtualDir = VirtualPathUtility.GetDirectory(virtualPath); string fullVirtualPath = VirtualPathUtility.Combine(baseVirtualDir, path); AddSourceDependency(fullVirtualPath); Assembly a = BuildManager.GetCompiledAssembly(fullVirtualPath); AddAssemblyDependency(a); }
internal PageParser (string virtualPath, string inputFile, HttpContext context) { #if NET_2_0 this.VirtualPath = new VirtualPath (virtualPath); #endif Context = context; BaseVirtualDir = VirtualPathUtility.GetDirectory (virtualPath, false); InputFile = inputFile; SetBaseType (null); AddApplicationAssembly (); LoadConfigDefaults (); }
public static string ResolveUrl(this HtmlHelper helper, string relativeUrl) { if (VirtualPathUtility.IsAppRelative(relativeUrl)) { return(VirtualPathUtility.ToAbsolute(relativeUrl)); } else { var curPath = WebPageContext.Current.Page.TemplateInfo.VirtualPath; var curDir = VirtualPathUtility.GetDirectory(curPath); return(VirtualPathUtility.ToAbsolute(VirtualPathUtility.Combine(curDir, relativeUrl))); } }
/// <summary> /// Returns either the root-most init page, or the provided page itself if no init page is found /// </summary> public static WebPageRenderingBase GetStartPage(WebPageRenderingBase page, string fileName, IEnumerable <string> supportedExtensions) { if (page == null) { throw new ArgumentNullException("page"); } if (String.IsNullOrEmpty(fileName)) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Cannot_Be_Null_Or_Empty, "fileName"), "fileName"); } if (supportedExtensions == null) { throw new ArgumentNullException("supportedExtensions"); } // Build up a list of pages to execute, such as one of the following: // ~/somepage.cshtml // ~/_pageStart.cshtml --> ~/somepage.cshtml // ~/_pageStart.cshtml --> ~/sub/_pageStart.cshtml --> ~/sub/somepage.cshtml WebPageRenderingBase currentPage = page; var pageDirectory = VirtualPathUtility.GetDirectory(page.VirtualPath); // Start with the requested page's directory, find the init page, // and then traverse up the hierarchy to find init pages all the // way up to the root of the app. while (!String.IsNullOrEmpty(pageDirectory) && pageDirectory != "/" && Util.IsWithinAppRoot(pageDirectory)) { // Go through the list of support extensions foreach (var extension in supportedExtensions) { var path = VirtualPathUtility.Combine(pageDirectory, fileName + "." + extension); if (currentPage.FileExists(path, useCache: true)) { var factory = currentPage.GetObjectFactory(path); var parentStartPage = (StartPage)factory(); parentStartPage.VirtualPath = path; parentStartPage.ChildPage = currentPage; currentPage = parentStartPage; break; } } pageDirectory = currentPage.GetDirectory(pageDirectory); } // At this point 'currentPage' is the root-most StartPage (if there were // any StartPages at all) or it is the requested page itself. return(currentPage); }
void AddVirtualDir(VirtualDirectory vdir, BuildProviderCollection bpcoll, Dictionary <string, bool> cache) { if (vdir == null) { return; } BuildProvider bp; IDictionary <string, bool> deps; var dirs = new List <string> (); string fileVirtualPath; foreach (VirtualFile file in vdir.Files) { fileVirtualPath = file.VirtualPath; if (BuildManager.IgnoreVirtualPath(fileVirtualPath)) { continue; } bp = GetBuildProvider(fileVirtualPath, bpcoll); if (bp == null) { continue; } if (!AddBuildProvider(bp)) { continue; } deps = bp.ExtractDependencies(); if (deps == null) { continue; } string depDir, s; dirs.Clear(); foreach (var dep in deps) { s = dep.Key; depDir = VirtualPathUtility.GetDirectory(s); // dependencies are assumed to contain absolute paths if (cache.ContainsKey(depDir)) { continue; } cache.Add(depDir, true); AddVirtualDir(GetVirtualDirectory(s), bpcoll, cache); } } }
public static MvcHtmlString RenderJsBundle(this HtmlHelper html, string bundlePath, BundleOptions options = BundleOptions.Minified) { if (string.IsNullOrEmpty(bundlePath)) { return(MvcHtmlString.Empty); } if (!CachePaths()) { BundleCache.SafeClear(); } return(BundleCache.GetOrAdd(bundlePath, str => { var filePath = HostingEnvironment.MapPath(bundlePath); var baseUrl = VirtualPathUtility.GetDirectory(bundlePath); if (options == BundleOptions.Combined) { return html.Js(bundlePath.Replace(".bundle", ""), options); } if (options == BundleOptions.MinifiedAndCombined) { return html.Js(bundlePath.Replace(".js.bundle", ".min.js"), options); } var jsFiles = File.ReadAllLines(filePath); var scripts = new StringBuilder(); foreach (var file in jsFiles) { if (file.StartsWith("#")) { continue; } var jsFile = file.Trim() .Replace(".coffee", ".js") .Replace(".ls", ".js"); var jsSrc = Path.Combine(baseUrl, jsFile); scripts.AppendLine( html.Js(jsSrc, options).ToString() ); } return scripts.ToString().ToMvcHtmlString(); })); }
private object GetProductOrModule(string current_vp) { string dirVP = VirtualPathUtility.GetDirectory(VirtualPathUtility.ToAppRelative(current_vp)); object result = null; int matchCount = int.MaxValue; foreach (var product in _products) { var prodVP = VirtualPathUtility.GetDirectory(product.StartURL); if (dirVP.IndexOf(prodVP, StringComparison.InvariantCultureIgnoreCase) != -1) { int diff = dirVP.Length - prodVP.Length; if (diff == 0) { return(product); } else if (matchCount > diff) { matchCount = diff; result = product; } } if (product.Modules != null) { foreach (var module in product.Modules) { var modVP = VirtualPathUtility.GetDirectory(module.StartURL); if (dirVP.IndexOf(modVP, StringComparison.InvariantCultureIgnoreCase) != -1) { int diff = dirVP.Length - modVP.Length; if (diff == 0) { return(module); } else if (matchCount > diff) { matchCount = diff; result = module; } } } } } return(result); }
/// <summary> /// 在指定虚拟路径上取消注册服务 /// </summary> /// <param name="service">要取消注册的服务对象</param> /// <param name="virtualPath">要取消注册的虚拟路径</param> /// <param name="backtracking">是否要上溯清理所有父级路径的注册,如果设置为 false 则只清理当前路径的注册</param> public static void UnregisterService(object service, string virtualPath, bool backtracking = true) { if (virtualPath == null) { throw new ArgumentNullException("virtualPath"); } if (service == null) { throw new ArgumentNullException("service"); } if (!VirtualPathUtility.IsAppRelative(virtualPath)) { throw VirtualPathHelper.VirtualPathFormatError("virtualPath"); } lock ( sync ) { servicesCache.Clear(); UnregisterCore(virtualPath, service); if (backtracking) { string parent; if (virtualPath == "~/") { parent = null; } else if (virtualPath.EndsWith("/")) { parent = VirtualPathUtility.Combine(virtualPath, "../"); } else { parent = VirtualPathUtility.GetDirectory(virtualPath); } if (parent != null) { UnregisterService(service, parent, true); } } } }
public string Process(string includedVirtualPath, string input) { if (includedVirtualPath == null) { throw new ArgumentNullException("includedVirtualPath"); } if (includedVirtualPath.Length < 1 || includedVirtualPath[0] != '~') { throw new ArgumentException("includedVirtualPath must be valid ( i.e. have a length and start with ~ )"); } var directory = VirtualPathUtility.GetDirectory(includedVirtualPath); return(CssRewriteUrlTransformFixed.ConvertUrlsToAbsolute(directory, input)); }
public IHttpActionResult DownloadExcel(string code, long feeNo = 0, DateTime?startDate = null, DateTime?endDate = null) { string mapPath = HttpContext.Current.Server.MapPath(VirtualPathUtility.GetDirectory("~")); IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>(); string path = string.Empty; switch (code) { case "View": this.View(); break; } return(Ok()); }
private string[] _GetDependencies(VirtualFile virtualFile) { var dir = VirtualPathUtility.GetDirectory(virtualFile.VirtualPath); string content; using (var stream = virtualFile.Open()) using (var reader = new StreamReader(stream)) content = reader.ReadToEnd(); return(_ReferenceRegex.Matches(content).Cast <Match>().Select(m => { var relativePath = m.Groups["path"].Value; return VirtualPathUtility.Combine(dir, relativePath); }).Where(m => this.ExcludedDependencies.All(e => !m.Contains(@"/" + e))).ToArray()); }
public void Process(BundleContext context, BundleResponse bundleResponse) { var CdnPath = context.HttpContext.Request.IsSecureConnection ? _config.SecureCdnPath : _config.CdnPath; var blob = string.Empty; var content = bundleResponse.Content; var contentType = bundleResponse.ContentType == "text/css" ? "text/css" : "text/javascript"; var file = VirtualPathUtility.GetFileName(context.BundleVirtualPath); var folder = VirtualPathUtility.GetDirectory(context.BundleVirtualPath).TrimStart('~', '/').TrimEnd('/'); var ext = contentType == "text/css" ? ".css" : ".js"; var azurePath = string.Format("{0}/{1}{2}", folder, file, ext).ToLower(); if (_config.BlobStorage.BlobExists(_config.Container, azurePath)) { blob = _config.BlobStorage.DownloadStringBlob(_config.Container, azurePath); } if (blob != content) { _config.BlobStorage.UploadStringBlob(_config.Container, azurePath, bundleResponse.Content, contentType, _config.BundleCacheTTL); } var AcceptEncoding = context.HttpContext.Request.Headers["Accept-Encoding"].ToLowerInvariant(); if (!string.IsNullOrEmpty(AcceptEncoding) && AcceptEncoding.Contains("gzip") && _config.UseCompression.Value) { azurePath = string.Format("{0}/{1}/{2}{3}", folder, "compressed", file, ext).ToLower(); if (_config.BlobStorage.BlobExists(_config.Container, azurePath)) { blob = _config.BlobStorage.DownloadStringBlob(_config.Container, azurePath); } content = content.CompressString(); if (blob != content) { _config.BlobStorage.CompressBlob(_config.Container, azurePath, bundleResponse.Content, contentType, _config.BundleCacheTTL); } } var uri = string.Format("{0}{1}/{2}", CdnPath, _config.Container, azurePath); if (context.BundleCollection.UseCdn) { using (var hashAlgorithm = new SHA256Managed()) { var hash = HttpServerUtility.UrlTokenEncode(hashAlgorithm.ComputeHash(Encoding.Unicode.GetBytes(content))); if (context.BundleCollection.GetBundleFor(context.BundleVirtualPath) != null) { context.BundleCollection.GetBundleFor(context.BundleVirtualPath).CdnPath = string.Format("{0}?v={1}", uri, hash); } } } }
/// <summary> /// 获取当前请求文件相对于应用程序根的虚拟路径的前缀符号表示 /// </summary> /// <param name="page"></param> /// <returns></returns> public static string GetVirtualUrlPrefix(Page page) { string vp = string.Empty; string arcefp = VirtualPathUtility.GetDirectory(HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath); int dirCount = arcefp.Substring(2).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Length; if (dirCount > 0) { for (int i = 0; i < dirCount; i++) { vp += "../"; } } return(vp); }
/// <summary> /// 装载当前访问页面的模版 /// </summary> protected virtual void LoadCurrentPageTemplate() { string filePath = VirtualPathUtility.GetDirectory(this.Request.FilePath); string fileName = Path.GetFileNameWithoutExtension(this.Request.PhysicalPath); string rootPath = this.Configuration.RootPath; //去掉站点根路径部分,以便转换为相对于模板路径,如将"/products/"转换为"products/" if (filePath.Length >= rootPath.Length) { filePath = filePath.Remove(0, rootPath.Length); } fileName = string.Concat(VirtualPathUtility.AppendTrailingSlash(filePath), fileName); this.LoadTemplateFromFile(this.Configuration.GetTemplateFile(fileName), this.Configuration.TemplateFileEncoding); }
public string CompileFromSource(Dictionary <string, string> files, out byte[] buffer) { var project = CreateProject(); foreach (var file in files) { var path = VirtualPathUtility.GetDirectory(file.Key); var p = VirtualPathUtility.ToAbsolute(path); var folders = p.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); var csDoc = project.AddDocument(file.Key, file.Value, folders); project = csDoc.Project; } return(Compile(project, out buffer)); }
public string Process(string includedVirtualPath, string input) { if (includedVirtualPath == null) { throw new ArgumentNullException("includedVirtualPath"); } // Handle virtual directories // Standard CssRewriteUrlTransform does not handle virtual directories properly, so we need custom code to handle this. // See http://stackoverflow.com/a/17702773 and http://aspnetoptimization.codeplex.com/workitem/83 includedVirtualPath = "~" + VirtualPathUtility.ToAbsolute(includedVirtualPath); string directory = VirtualPathUtility.GetDirectory(includedVirtualPath.Substring(1)); return(ConvertUrlsToAbsolute(directory, input)); }
/// <summary> /// Gets a reference to the currently active application configuration object. /// </summary> private static System.Configuration.Configuration GetCurrentConfiguration() { // First - if we've previously cached the current configuration, return it if (Config != null) { return(Config); } // Next - if we're running in a web context, cache & return the current web configuration if (HttpContext.Current != null) { var rootPath = HttpContext.Current.Request.ApplicationPath; var currentPath = VirtualPathUtility.GetDirectory(HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath); while (currentPath.Length >= rootPath.Length) { Config = WebConfigurationManager.OpenWebConfiguration(currentPath); if (Config.HasFile) { return(Config); } else { currentPath = currentPath.Substring(0, currentPath.LastIndexOf('/')); } } Config = WebConfigurationManager.OpenWebConfiguration("~"); return(Config); } var configFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; configFileName = configFileName.Replace(".config", "").Replace(".temp", ""); // check for design mode if (configFileName.ToLower(CultureInfo.InvariantCulture).Contains("devenv.exe")) { Config = GetDesignTimeConfiguration(); } else { Config = GetRuntimeTimeConfiguration(); } return(Config); }
public IHttpActionResult View() { string dir = HttpContext.Current.Server.MapPath(VirtualPathUtility.GetDirectory("~")); FlexPaperConfig configManager = new FlexPaperConfig(dir); string doc = HttpContext.Current.Request["doc"]; string page = HttpContext.Current.Request["page"]; string swfFilePath = configManager.getConfig("path.swf") + doc + page + ".swf"; string pdfFilePath = configManager.getConfig("path.pdf") + doc; if (!Util.validPdfParams(pdfFilePath, doc, page)) { HttpContext.Current.Response.Write("[Incorrect file specified]"); } else { String output = new pdf2swf(dir).convert(doc, page); if (output.Equals("[Converted]")) { if (configManager.getConfig("allowcache") == "true") { Util.setCacheHeaders(HttpContext.Current); } HttpContext.Current.Response.AddHeader("Content-type", "application/x-shockwave-flash"); HttpContext.Current.Response.AddHeader("Accept-Ranges", "bytes"); HttpContext.Current.Response.AddHeader("Content-Length", new System.IO.FileInfo(swfFilePath).Length.ToString()); HttpContext.Current.Response.WriteFile(swfFilePath); } else { HttpContext.Current.Response.Write(output); } } HttpContext.Current.Response.End(); if (File.Exists(pdfFilePath)) { File.Delete(pdfFilePath); } if (File.Exists(swfFilePath)) { File.Delete(swfFilePath); } return(Ok()); }
/// <summary>Register that this view has been used in this current request</summary> public void Register <T>(WebViewPage <T> viewPage) { var virtualPath = viewPage.VirtualPath; if (!_list.Contains(virtualPath)) { _list.Insert(0, virtualPath); } var folderPath = VirtualPathUtility.GetDirectory(virtualPath); folderPath = VirtualPathUtility.Combine(folderPath, VirtualPathUtility.GetFileName(folderPath)); if (!_list.Contains(folderPath)) { _list.Insert(0, folderPath); } }
protected void Page_Load(object sender, EventArgs e) { configManager = new Config(Server.MapPath(VirtualPathUtility.GetDirectory(Request.Path))); if (configManager.getConfig("admin.password") != null && Session["FLEXPAPER_AUTH"] == null) { Response.Redirect("Default.aspx"); Response.End(); } if (Request["SQL_CONNECTIONSTRING"] != null) { string respcode = "0"; try{ using (SqlConnection conn = new SqlConnection(String.Format(Request["SQL_CONNECTIONSTRING"]))) { conn.Open(); try { SqlCommand nonqueryCommand = conn.CreateCommand(); nonqueryCommand.CommandText = "CREATE TABLE [dbo].[temp]([id] [varchar](255))"; nonqueryCommand.ExecuteNonQuery(); nonqueryCommand.CommandText = "DROP TABLE [dbo].[temp]"; nonqueryCommand.ExecuteNonQuery(); } catch (Exception ex) { respcode = "cannot_create"; } if (respcode == "0") { respcode = "1"; } conn.Close(); } } catch (Exception ex) { respcode = "0"; } Response.Write(respcode); } }