I have one issue in my webpage. Actually I have developed asp.net 3.5 website. I have created a webpage named under Sub Directory in my project root directory. 下创建了一个名为的网页。
Webpage Location
(ProjectName) >> Department (Subfolder) >> HR (Subfolder) >> HR.aspx
and I have the code in this file to open a file like pdf.
My file location folder is under my project.
File Location
(ProjectName) >> SIPL (SubFolder) >> Department (Subfolder) >> HR (Subfolder) >> HR.pdf
My issue is when I put the HR.aspx page under root directory the file is opening successfully and when I put this page under subfolder (as shown above) it not opening and showing file not found error. I think page not find the path of the file because it is in subfolder. How to overcome this issue. Please help.
It should be
<pre>
<img src="\Images\Open.jpg"/>
</pre>
To use a file in you web application. You should have a folder in your application.
Say you have a folder Images at your root directory.
Then you should use the relative path of you image.
More Details
HTML img and ASP.NET Image and relative paths
Since you have written
<img src="C:\Users\Administrator\Desktop\Open.jpg"/>
which is wrong for the web application.
If you write like above the browser will look for the local system file.
Rather than file on the application-server.
please relative path to select the image . So first copy the image in any of your project solution folder and refer like:
<img src='\NewFolderName\Open.jpg'/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.