I'm maintaining an old ASP.NET web application that runs on our company network.
I have moved it across from an old Windows Server 2003 R2 to a Windows Server 2012 R2.
In it there is a GridView
with a column of HyperlinkField
's which take their links from an object's properties based on other data in the session and point to .pdf files on the server.
In the code there are these strings:
FileLoc = "D:\Manufacturing\Production Engineering\Production Drawings\"
ServerFileLoc = "/Production/Production Drawings/"
So I assumed that a virtual directory was set up in IIS.
In IIS Manager I created a new Website and in that website I added an application which points to the root folder of the web app. I then created a virtual directory in the web site which points to "D:\Manufacturing\Production Engineering" and named it "Production" but when I run the web site and click on the links it adds the URL to the end of the root directory of the app and I get an error stating :
Requested URL http://localhost:62322/Production/Production Drawings/PD1067250000 ACT20P Bridge Housing Assembly 10-09-09.pdf
Physical Path D:\Design Development Engineering\Engineering\Database\Products\Production\Production Drawings\PD1067250000 ACT20P Bridge Housing Assembly 10-09-09.pdf
D:\Design Development Engineering\Engineering\Database\Products is the root directory of the web app.
How do I stop it from adding the root directory at the beginning?
Is there something I have not set up correctly in IIS for the virtual directory to work?