Click here to Skip to main content
16,016,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi iam yogesh iam new to this communit... iam using asp.net . when i set the imageurl of html image control, the image is displayed at design time. but when i run the project the page shows the image control without image, and a small imamge icon on the upper left corner.
my code is here.. iam not new to asp. but i think its some different problem..
pls reply me soon friends....

C#
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="imageview.aspx.cs" Inherits="ADVANCED_FORUM.imageview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head  runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1"  runat="server">
    <div>
        <img id="image1"  runat="server" alt="not avail." style="z-index: 100; left: 18px; position: absolute; top: 15px; height: 81px;" src="c:\photos\a1.jpg"/>
    </div>
    </form>
</body>
</html>
Posted

1 solution

Your web site may not have permission to view photos folder from C root directory. So copy the desired image to your website and use relative path(~) to display the image. i.e
XML
<div>
        <img id="image1"  runat="server" alt="not avail." style="z-index: 100; left: 18px; position: absolute; top: 15px; height: 81px;" src="~/photos/a1.jpg"/>
    </div>
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Aug-11 15:02pm    
This directory is certainly not accessible to the HTTP server, for quite a good reason. It only has access to files under it's own root directory specified in the site settings. My 5.
--SWA
Wonde Tadesse 7-Aug-11 15:12pm    
Thanks --SA
yogesh a sharma 7-Aug-11 15:18pm    
thanks for your reply sir but i stiil can't
get the solution i also tried the relative path but its not working src="~/photos/a1.jpg" is giving red line i.e the syntax is wrong. iam using c#

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