Displaying images from the host site for an app in a subdirectory. Can it be done?

Discussion in 'ASP.NET 2.0' started by taxtomaz, Dec 20, 2007.

  1. I have pages in my subdirectory application that show images at run time. How would i load these images from the root application images folder (or can I?).

    Thanks for any help.

    Tom
     
  2. Can you explain more on what you mean by showing images at runtime? Do you have somemodule processing the images?




    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Yes I am loading them from the codebehind based on user selections.



    If File.Exists(Server.MapPath("~/Images/Diamonds/Thumbs/" + StockNo1 + ".jpeg")) Then
    img11.ImageUrl = "~/Images/Diamonds/Thumbs/" + StockNo1 + ".jpeg"
    img11.Visible = True
    Dim p1 As Image = New Image
    p1 = ASPxPopupControl1.Windows.FindByName("Page1").FindControl("Image1")
    p1.ImageUrl = "~/Images/Diamonds/" + StockNo1 + ".jpeg"
    Else
    img11.ImageUrl = "~/Images/Diamonds/dina.jpg"
    img11.Visible = True
    End If
    The running app is in a subdirectory of the main site. Using a domain pointer to steer traffic there.

    Thx,

    Tom</CODE>
     
  4. You should be able to do this if the images folder is in the root one level up.

    img11.ImageUrl = "~/../Images/Diamonds/dina.jpg"



    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Thanks Aristotle; that got it. Much to simple!

    Tom
     

Share This Page