Page view counter

Displaying Images from Server?

Last post 08-15-2005 1:25 PM by subdigital. 2 replies.

Sort Posts:

  • Sad [:(] Displaying Images from Server?

    08-15-2005, 2:17 AM
    • Loading...
    • sohamraj
    • Joined on 08-15-2005, 6:09 AM
    • Posts 7
    • Points 35
    Hi Gurus,

    I uploaded image "abc.jpg" on server int propertypic folder and save only file name "abc.jpg" in database.
    Now i want to display image on my form I wroted following code.

    Image1.ImageUrl = "../Pages/ShowImage.aspx?image="+_ds.Tables[0].Rows[0][3].ToString();
    Image1.ImageUrl = "http://www.mydomaincom/propertypics/" + _ds.Tables[0].Rows[0][3].ToString();
    Image1.ImageUrl = "../propertypics/" + _ds.Tables[0].Rows[0][3].ToString();

    This code is working fine on localhost but not on live domain.
    Image1 is showing physical path like

    file:///C:/Inetpub/vhosts/mydomain.com/httpdocs/propertypics/ACS42.jpg


    Its quite urgent, I am facing problem from last three days, please help me out.
    Thanks in advance.

  • Re: Displaying Images from Server?

    08-15-2005, 12:20 PM
    • Loading...
    • billrob458
    • Joined on 07-25-2003, 2:44 AM
    • New York, NY
    • Posts 671
    • Points 3,329
    Without knowing your directory structure, I can only guess at a solution.

    Image1.ImageUrl = "~/propertypics/" + ds.Tables[0].Rows[0][3].ToString();

    The ~ will write out a link starting from the root of the application. 

    bill
  • Re: Displaying Images from Server?

    08-15-2005, 1:25 PM
    • Loading...
    • subdigital
    • Joined on 08-11-2004, 12:02 PM
    • Houston
    • Posts 441
    • Points 2,087
    • ASPInsiders
    sometimes paths can be a pain.

    take a look at this url for some help


    Ben Scheirman
    http://www.flux88.com

    ASP.NET MVP
    Certified ScrumMaster
    ASPInsider
    MCSD
Page 1 of 1 (3 items)