Artex
Artex

Reputation: 155

Asp.net Images are giving 401 unauthorized error randomly

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

Upvotes: 8

Views: 9041

Answers (5)

KiranPalode
KiranPalode

Reputation: 498

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?

Upvotes: 15

Dev
Dev

Reputation: 6710

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

Upvotes: 0

Rui Marques
Rui Marques

Reputation: 3485

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.

Upvotes: 0

Lilith River
Lilith River

Reputation: 16468

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?

Upvotes: 0

asd
asd

Reputation:

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....

Upvotes: 0

Related Questions