filtrationproducts
asked on
ASP MVC 3 - Modify Directory location
I have the code below and I need to add a directory called "maintenance" after the cID. I tried adding it in manually using '+ "\maintenance\"' after the + cId but it went all squiggly line on me. I am new the ASP MVC (Razor) so any help would be greatly appreciated!
Thanks!
Thanks!
{
var maintPath = System.Configuration.ConfigurationManager.AppSettings.Get("MaintenancePath");
if (System.IO.Directory.Exists(maintPath))
{
maintPath += "\\" + cId";
var files = System.IO.Directory.GetFiles(maintPath);
foreach (string file in files)
{
var fileInfo = new System.IO.FileInfo(file);
var maintFile = new Models.ContractorMaintenanceFile(cId, file);
if (maintFile.IsValid)
fileList.Add(maintFile);
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad that was all you needed. Just as an FYI if you place an @ in front of the variable it eliminates the special character. So for example...
string directory = "c://myfolder//somethingel se//"; could be re-written like:
string directory = @"c:/myfolder/somethingels e/";
And those would yield the exact same results. But with the @ in front, it makes it easier to look at.
string directory = "c://myfolder//somethingel
string directory = @"c:/myfolder/somethingels
And those would yield the exact same results. But with the @ in front, it makes it easier to look at.
ASKER
Thanks!
ASKER
Thanks!