Hi guys, I'm planning on using this code to loop out product related files on a ecom product template - is there any security issues using GetFiles that way?
@using System.Web; @using System.IO; @using System.Linq; @{ var productNumber = ""; productNumber = GetString("Ecom:Product.Number"); var root = "/Files/Images/ecom/products/relatedfiles"; var thedirectory = new DirectoryInfo(HttpContext.Current.Server.MapPath("~"+root+"/"+productNumber)); if (thedirectory.Exists) { var files = thedirectory.GetFiles(); if (files.Any()) { foreach (var file in files) { var fileName = file.Name; var fileSize = CustomMethods.SizeSuffix(file.Length, 2); var fileUrl = "Admin/Public/DWSDownload.aspx?File=" + string.Format("{0}/{1}", root, fileName); <pre><a href="@fileUrl">@fileName @fileSize</a></pre> } } } else { <pre>nodir</pre> } }