I have a treeview of files and folders and each tree node is configured to send the node text and value to the controller to redirect and display the files list if its a folder or display the content if its a file. Value will usually be a Url to the clicked folder or file.
Set double escaping in web.config
Problem: Encoded Url for a file is not recognised as query string parameter if it has more than one %252f character.enter code here
Worked Url: http://[host]/Admin/Files/CSS/Content%252ftest.css
Failed Url: http://[host]/Admin/Files/CSS/Content%252fStyles%252ftest.css
[ValidateInput(false)]
public ActionResult EditBrowsableFile(string groupName, string fileName)
{
if (groupName != null && fileName != null)
{
var content = FileService.GetFileContent(Server.MapPath("~/" + System.Web.HttpUtility.UrlDecode(fileName)));
ViewData["SelectedFile"] = new FileBrowser() { FilePath = fileName, GroupName = groupName, FileContent = content }; ;
}
return View("BrowsableFiles");
}
<security>
<requestFiltering allowDoubleEscaping="true"/>
</security>