Okay after massive amount of Googling and trying different things this is probably something simple that I'm messing up on.
Basically what I'm doing is parsing a productID from a url and adding XL.jpg to the end. For example lets say the product id was 1234 the program would search for 1234XL.jpg in the folder that's provided in the PathToFolder (C://LiveSite/img/XL/).
Everything works as planned until the pathing part. It parses the url adds XL.jpg to the end and even follows the path I have set, but I get an error, "The address wasn't understood. Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program." The other browsers just have a blank window.
This is what shows up in my browser: c://LiveSite/img/XL/1234XL.jpg
protected void OpenImg_Click(object sender, EventArgs e)
{
int i = 0;
string PathToFolder = "C://LiveSite/img/XL/";
var dirInfo = new DirectoryInfo(PathToFolder);
string FileName = Variables.param + "XL.jpg";
var foundFiles = dirInfo.GetFiles(FileName);
if (foundFiles.Length == 1)
{
ClientScript.RegisterStartupScript(this.GetType(), "openFoundImage", "window.open('" + PathToFolder + foundFiles[i].Name + "');", true);
}
}
}
}
What am I messing up on that it won't path to the server? Is there something I should be using instead of C:// ? I've tried flipping the slashes the other way and using C:/ none worked.
Thanks in advance for your help.
Edit:
Sorry about the confusion. The images are not located on my computer or in the project. They are on a remote server, sql server if that matters. I'm not sure if I am starting the directory off correctly if I want to link to a server.
On the server I want to link it to the path to the folder in C://LiveSite/img/XL/ I now understand that linking it like that would only open if i was doing it on that server. So how do I link to that folder from the internet browser? Can I use the piece of code I have written at all or do I have to do it a completely new way?
This is an asp.net web application