Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / November 2005

Tip: Looking for answers? Try searching our database.

ASP.NET Images are not displayed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Hein - 04 Nov 2005 22:33 GMT
Hi, I have a problem with the standard Image controls and img tag.  The
images are being displayed in the designer, but not when I view the page.
Tried clearing the cache - I'm using the built in web server.  Any help
would be appreciated.

Regards,

Richard Hein
"Gary Chang[MSFT]" - 05 Nov 2005 07:44 GMT
Hi Richard,

>Hi, I have a problem with the standard Image controls
>and img tag.  The images are being displayed in the
>designer, but not when I view the page.

Would you please tell me how do you specify the picture's location in your
web page?

You need to specify a URL addess of your target picture file in the web
page's img tag, providing a  local path will not work when you browse that
page in a Browser...

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Richard Hein - 07 Nov 2005 17:06 GMT
Hi Gary,

All I'm doing is adding these (tried both):

<img src="App_GlobalResources/images/logo.gif" />
<asp:Image ID="Image1" ImageUrl="~/App_GlobalResources/images/logo.gif"
runat="server" />

Neither works.  The URL resolves correctly, if I look at the page rendered
and check the properties of the placeholder.  I've tried putting the image
in another directory, including the root in case it was a permission issue.
No dice.

Regards,

Richard Hein

> Hi Richard,
>
[quoted text clipped - 23 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Gary Chang[MSFT]" - 08 Nov 2005 03:33 GMT
Hi Richard,

><img src="App_GlobalResources/images/logo.gif" />
><asp:Image ID="Image1" ImageUrl="~/App_GlobalResources/images/logo.gif"
>runat="server" />

Since the property would be change after the page has been compiled, so  I
suggest you retrieve that image's URL from the web page in the
browser(right click the picture's position and select its Property), then
check it whether it could be resolved after compiling.

By the way, we recommend you do not put the /images/ folder under the
/App_GlobalResources/ folder, the /App_GlobalResources/ folder is a
specific folder and its content will be complied as resource, so it is
better to move your /images/ folder into another place...

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Richard Hein" <Auxon@noemail.noemail>
>References: <uYctgdY4FHA.3588@TK2MSFTNGP15.phx.gbl>
<BfctyRd4FHA.1172@TK2MSFTNGXA01.phx.gbl>
>Subject: Re: ASP.NET Images are not displayed
>Date: Mon, 7 Nov 2005 12:06:16 -0500
[quoted text clipped - 50 lines]
>> Get Secure! ¡§C www.microsoft.com/security
>> Register to Access MSDN Managed Newsgroups!

http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
>> &SD=msdn
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
Richard Hein - 08 Nov 2005 14:53 GMT
So the image in a Master Page doesn't resolve properly in inheriting pages,
because the image src url is relative to the inheriting page, rather than
the Master?  Using ~\images\logo.gif doesn't resolve properly either, the
source of the image at runtime is under the current page's directory.

> Hi Richard,
>
[quoted text clipped - 94 lines]
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
Richard Hein - 08 Nov 2005 15:01 GMT
Actually, it resolves using the ASP Image tag:

<asp:Image ID="Image1" runat="server" ImageUrl="~/images/analytics_logo.gif"
/>

But not the HTML Img tag:
<img src="~/images/logo.gif" />

> So the image in a Master Page doesn't resolve properly in inheriting
> pages, because the image src url is relative to the inheriting page,
[quoted text clipped - 103 lines]
>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>> rights.
Mikhail Arkhipov (Microsoft) - 08 Nov 2005 16:56 GMT
On 11/8/05 7:01, in article OvcNFVH5FHA.3760@TK2MSFTNGP14.phx.gbl, "Richard
Hein" <Auxon@noemail.noemail> wrote:

> Actually, it resolves using the ASP Image tag:
>
[quoted text clipped - 111 lines]
>>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>>> rights.

~/ only works for server-side controls, i.e. with runat="server". If control
has no runat="server" attribute, it is not processed by ASP.NET runtime.
Client browser does not understand ~ syntax, it is specific to ASP.NET.

Thanks
Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights
Richard Hein - 08 Nov 2005 21:51 GMT
I see.  Of course that makes sense.

> On 11/8/05 7:01, in article OvcNFVH5FHA.3760@TK2MSFTNGP14.phx.gbl,
> "Richard
[quoted text clipped - 130 lines]
> Mikhail Arkhipov (Microsoft)
> -- This post is provided 'AS IS' with no warranties and confers no rights
ManniAT - 10 Nov 2005 08:40 GMT
Hi,

if the IDE would support "root webs" this would be no problem.
A <img src="/images/... would work from everywhere in the web.

Unfortunately file system webs always refer to a subdirectory.
That is a big "missing thing" in opinion because haveing this would mean to avoid a lot of troubles.

Regards

Manfred

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.