/// <summary> /// Returns the file path to the url provided (urlToMap) /// /// For example http://server:port:/a/file.aspx should return c:\path\to\server\a\file.aspx /// </summary> /// <param name="apiCassini"></param> /// <param name="urlToMap"></param> /// <returns></returns> public static string file_From_Url(this API_Cassini apiCassini, string urlToMap) { var url = apiCassini.url(); if (urlToMap.contains(url)) { return(apiCassini.mapPath(urlToMap.remove(url))); } return(null); }
/// <summary> /// Creates a file inside the current web root /// /// returns the path to the file created /// </summary> /// <param name="apiCassini"></param> /// <param name="fileVirtualPath"></param> /// <param name="fileContents"></param> /// <returns></returns> public static string create_File(this API_Cassini apiCassini, string fileVirtualPath, string fileContents) { if (fileContents.valid()) { var filePath = apiCassini.mapPath(fileVirtualPath); if (filePath.valid() && filePath.file_Not_Exists()) { return(fileContents.saveAs(filePath)); } } return(null); }