Click here to Skip to main content
15,742,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have my website C:\inetpub\wwwroot\website. in my website i upload the image using c# to c:\inetpub\wwwroot\Uploadimages\. i have successfully upload image in this folder. but i could not get image from this path to display image in website. how to display image from outside the root folder. please any one help me with that.?
Sajith Dilhan 4-Mar-15 3:22am    
<img src="<%=yourpath%>/Images/imgxx.png" />

you can specify the path in web.config file.
Member 10705961 4-Mar-15 3:35am    
i have to give path in c#. how to do outside the project folder path in c#.?
[no name] 4-Mar-15 3:28am    
C:\inetpub\wwwroot\websitename\Uploadimages\img.jpg ? this is ur path.u can easily retrieve the u got any error?
Member 10705961 4-Mar-15 3:34am    
can you please elaborate with some code. i already using with web.config file, but it did not work
Sajith Dilhan 4-Mar-15 3:43am    
put the path in web config
< configuration>
< appsettings>
< add key="ImagePath" value="C:\inetpub\wwwroot\websitename\Uploadimages">

< /configuration> ;

then read it from C# code
string path= WebConfigurationManager.AppSettings["ImagePath"]

1 solution

<form id="form1"  runat="server">
<asp:image id="Image1" runat="server" imageurl="~/Uploadimages/imag.jpg" />
<%--'~' it's denoting the root path--%>
Share this answer
Member 10705961 4-Mar-15 3:49am    
the path is dynamic. so i want to give image path using c#. the path change based on user selection
Sajith Dilhan 4-Mar-15 3:51am    
then you have to bind the path in page load event dynamically.
get the path into a variable based on the user selection.
then bind to image
<img src="<%=yourpath%>/Images/imgxx.png" />
Member 10705961 4-Mar-15 3:53am    
can you please give code in c#
[no name] 4-Mar-15 4:02am    
try this :
Member 13161813 30-Nov-17 0:13am    
Dear sir/mam
please help me given below question .
Display Images saved in folder outside the Website Root directory With using DataTable in GridView ASP.Net

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900