The View:
<div class="project" style="background-image: url('@project.ProjectLogoPath')">
The Model:
public List<Projects> GetProjects() {
DataContext dbContext = new DataContext();
List<Projects> projects_list = new List<Projects>();
foreach (Project p in dbContext.Projects) {
Projects c = new Projects();
c.ProjectName = p.p_name;
c.ProjectNumber = p.p_num;
c.CompanyName = p.co_name;
c.ClientName = p.cl_name;
c.ProjectLogoPath = "../../Storage/" + p.co_name + "/Clients/" + p.cl_name + "/" + p.p_num + "_" + p.p_name + "/99_Other/project_logo.png";
projects_list.Add(c);
}
return projects_list;
}
The Controller:
public ActionResult Index() {
ProjectsBAL b = new ProjectsBAL();
List<Projects> c = b.GetProjects();
ViewBag.ProjectsData = c;
UserBAL u = new UserBAL();
Users use = u.GetUser();
ViewBag.Username = use.Username;
ViewBag.Domain = use.Domain;
ViewBag.Company = use.Company;
return View("Index");
}
This works perfectly well. The problem is that all my 1000 Terabytes of content data cannot be stored in the subfolder, the content will be stored on a remote server and the drive will be mounted to the IIS server, drive letter M. My question is how do I make the path correctly? The line of concern is this:
c.ProjectLogoPath = "../../Storage/" + p.co_name + "/Clients/" + p.cl_name + "/" + p.p_num + "_" + p.p_name + "/99_Other/project_logo.png";
I've already tried:
c.ProjectLogoPath = "M:/Storage/" + p.co_name + "/Clients/" + p.cl_name + "/" + p.p_num + "_" + p.p_name + "/99_Other/project_logo.png";
I've also tried replacing all "/" with "\". Also tried using "file://///" at the start which seemed to work only sporadically (e.g. wouldn't work when I refreshed the page but would work if I pressed the Home button).
Basically, just imagine that the standard content folder for your website is so immensely large that it is no longer appropriate to store it on the web server, but rather on another data server. That is the problem I am trying to solve.