Im having a asp.net application run on IIS 7.5 In one of the pages, there is a " view file" link. This points to( in code) a physical directory eg: D:\Campoff\policy.
Whenever the user clicks on the link, a file under that physical directory get downloaded. However, when i run the application on IIS, when i point to that " View file" link, it points to http://localhost/Campoff/policy. this gives the 404 error( FIle not found).
The location of the physical directory is in Web.config file in a key value pair.And that is being addressed in the code.
Here's what I'm calling
protected string getLinkText(string policyNo)
{
string str = "";
if (File.Exists(ConfigurationManager.AppSettings.Get("InsurancePolicyFileDir") +
policyNo + ".pdf"))
str = policyNo;
return str;
}
str
ends up being localhost/insurancepolicydir instead of d:\insurancepolicydir
Please help me understand, what is happening or what is wrong with my setting?