Hiral Bavisi Hiral Bavisi - 3 months ago 18
ASP.NET (C#) Question

Not showing the images in live server which is showing in my local host

I am working on the Mailbox Module in VS2010 with C#

I have made a control with ascx page and in that page I have created Three different gridviews for Inbox,SentItems and Deleted Items.

In all the three gridviews I have added two columns for the Images for Reply and Forward messages which is shown where the user reply or forward the message.

The functionality works perfectly in my localhost.

But today i have deployed it on live server.

Where I found that I does not showing the images.

When I inspected elements through firebug I found in the HTML source code that it shows me that the "Failed To Load The Given URL" while for other images it shows the images.

Can Anyone tell me why is it happening and help me..?


Check if the url is pointing to the correct physical path on live sever.

Refer this - ASP.NET Web Project Paths

ASP.NET resolves the ~ operator to the root of the current application. You can use the ~ operator in conjunction with folders to specify a path that is based on the current root.

The following example shows the ~ operator used to specify a root-relative path for an image when using the Image server control In this example, the image file is read from the Images folder that is located directly under the root of the Web application, regardless of where in the Web site the page is located.

<asp:image runat="server" id="Image1"
  ImageUrl="~/Images/SampleImage.jpg" />

You can use the ~ operator in any path-related property in server controls. The ~ operator is recognized only for server controls and in server code. You cannot use the ~ operator for client elements.