4 Replies - 3780 Views - Last Post: 19 September 2012 - 06:17 AM Rate Topic: -----

#1 c#think#:)  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 114
  • Joined: 17-March 10

Image.ImageUrl is correct but image is not displayed...

Posted 14 September 2012 - 06:39 AM

Hi there Gurus!

I have an Image control on my form. At run time i assign an URL that is correct, i know that it is correct because i display that myImg.ImageUrl in a label and i see - C:\Inetpub\RTVSearchWords\germany\tempLogos\myPic.jpg. this path really exists on the server.
"germany" is a root directory for my website.

The logic is simple: Image should only appear at certain circumstance. Otherwise the control should be there but with a red 'X' at the top left corner. If image should be there then of course image control should display it but it wont :( ...
but image control is not showing red 'X' either, it shows some kind of an icon at the top left corner. It seems that image control actually receives URL but cant show it. If i view page source then i see that this img get correct url.

Struggling whole day already without any success. I wonder if it could be IIS issue. For example some configuration that blocks images?...

Thanks in advance guys!

Is This A Good Question/Topic? 0
  • +

Replies To: Image.ImageUrl is correct but image is not displayed...

#2 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1370
  • View blog
  • Posts: 3,021
  • Joined: 05-April 11

Re: Image.ImageUrl is correct but image is not displayed...

Posted 14 September 2012 - 08:51 AM

I would say it is your URL being incorrect :)

I also think that the correct url is /germany/tempLogos/myPic.jpg
Was This Post Helpful? 1
  • +
  • -

#3 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,673
  • Joined: 24-August 11

Re: Image.ImageUrl is correct but image is not displayed...

Posted 18 September 2012 - 01:05 PM

I would think that CasiOo is correct. Backslashes are correct for file paths, but URLs use forward slashes. Besides, if these images live in a folder within your site, why would you try to drill all the way down to the root and build the path back up? The folder that contains your website is the root as far as the site is concerned, so even an absolute path would start with that folder's full name (including path) inferred.
Was This Post Helpful? 1
  • +
  • -

#4 c#think#:)  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 114
  • Joined: 17-March 10

Re: Image.ImageUrl is correct but image is not displayed...

Posted 19 September 2012 - 01:53 AM

Thanks for answers guys!

You both are right that URL should start from root but on another hand actually an absolute URL is also working when binding ImageUrl. When i debug it in VS i get those images even when URL starts from C drive. But when site was deployed on a server it didn't show anything.

The problem was that this URL "C:\Inetpub\RTVSearchWords\germany\tempLogos\myPic.jpg" is correct but it is client machine relevant. Image control thought that image is on client machine and of course there were no such file or directory.

Well my goal was to display images, but since above method didn't worked i used HttpHandler and set imageUrl as a myHandler.ashx?imgID=... And that was much easier.


Thanks again guys,
Both of you get a '+' mark :)

Best Regards,
C#think#:)
Was This Post Helpful? 0
  • +
  • -

#5 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1370
  • View blog
  • Posts: 3,021
  • Joined: 05-April 11

Re: Image.ImageUrl is correct but image is not displayed...

Posted 19 September 2012 - 06:17 AM

So the URL wasn't correct :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1