8

I am using Asp.net, IIS 6 and cdn for serving images. I am having a problem with loading the images in my website. images are under a virtual folder. Everytime I hit refresh of the browser, some of the images gives 401 unauthorized error. (images and number of images displayed which gives 401 error differs in every refresh.) I am having hard time to solve this problem. Any help will be welcomed a lot.

Kind Regards.

PS: I am also using a load balancer to distribute traffic among two servers. One of the servers has actual files and a virtual folder for them. The other server has virtual folder which shows the path and ip of the server which has files. I tried using website via each server but they both have the same problem.

Here are the headers;

Response:

HTTP/1.1 401 Unauthorized
Content-Length: 1608
Content-Type: text/html
Server: Microsoft-IIS/6.0
Date: Thu, 28 Apr 2011 14:38:55 GMT

Request

GET /img/blog/2011%2f4%2f4.png HTTP/1.1
Host: cdn.***.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 ( .NET CLR 3.5.30729)
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.***.com/Blog
Artex
  • 155
  • 1
  • 6
  • I don't know the actual answer to this, but perhaps you should set up a single share between the two and use virtuals for both, maybe that would at least help isolate the problem. – MrGrigg Apr 28 '11 at 14:40
  • Thank you for your interest but it is already like that, I edited the question accordingly. – Artex Apr 28 '11 at 14:46
  • Actually I am not really sure if there is a problem with caching or virtual folder permissions. I am open to any suggestions. – Artex Apr 28 '11 at 15:06
  • Have you tried little hackalicious fixes, like setting all permissions to everyone at the top and let it recurse down through your directory? – MrGrigg Apr 28 '11 at 16:07
  • 1
    Is your virtual directory referencing a network UNC path? If so you need to ensure you specify credentials that have access to that path, or ensure your application pool identity has access to that path. – David Duffett May 04 '11 at 12:48
  • 1
    On each server, try adding a custom Http Header (something that only you will understand) so you can know which server is generating the error. you can do it in IIS Manager or in the `` section. ([IIS Docs](http://www.iis.net/ConfigReference/system.webServer/httpProtocol/customHeaders)) – Eric Falsken May 06 '11 at 06:24

5 Answers5

15

Add permission for following users to that virtual image folder

  1. IUSR
  2. IIS_IUSRS

After adding the above permission please check whether 401 error is still there or not?

KiranPalode
  • 498
  • 3
  • 8
  • 23
0

please set the security permission of your site images folder to iis_user or everyone and give its full rights and this error resolved forever.

Try this in my one site i got same problem and by using this way i resolved this error....

0

If the problem images change with each refresh, it's probably not a permissions issue - sounds instead like there is some kind of locking going on. Do you have the indexing service turned on, or an AV solution running?

Lilith River
  • 16,204
  • 2
  • 44
  • 76
0

Have you investigate IIS logs? This is, almost 100% sure, related with the access level the virtual folder and you may need to set special credentials when opening the target location.

How to enable IIS 6 logging? Here. How to analyze IIS logs? Here.

Rui Marques
  • 3,429
  • 1
  • 22
  • 26
0

Make sure the mime-types are for the extensions you use of images are configures in your IIS.

Dev
  • 6,570
  • 10
  • 66
  • 112