How to access image from the server folder

  • Thread starter Manish Songar via .NET 247
  • Start date
M

Manish Songar via .NET 247

(Type your message here)
I am using asp.net. I am not storing image in sql server.I store all
the image in one folder. I want to access image from that folder to my
client machine. Images folder (\Data_Image) store in the same place
into the application root (server machine) like
c:\inetpub\wwwroot\mywebapp\Data_Image. I am using repeter control for
show images. I already use server.Mappath but still when I run my
application in client machine it still look for the image on client
machine itself. Is am I doing wrong....
My code as followes:

Dim dt As New DataTable("Orchid")
Dim FullPath As String
Dim col As DataColumn
Dim Rowimg As DataRow
col = New DataColumn("image", GetType(String))
dt.Columns.Add(col)
FullPath = Server.MapPath(".") & "\data_Image\" & Rose.GIF
Rowimg = dt.NewRow
Rowimg.Item("image") = FullPath
dt.Rows.Add(Rowimg)
RepImg.DataSource = dt
RepImg.DataBind()
can anybody solve my problem.
 
S

Scott Allen

Hi Manish:

You want to send the result of Server.MapPath to the client, because
MapPath returns a physical directory on the server. Just use the
relative path to the image and the client should see it just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top