Geeks With Blogs
Srijith Sarman Time,space and living
HTTP 400 Bad Request
HTTP 404 File Not Found

Anybody who has done some web development would have surely come across these errors. These could be arguably most popular error codes in the HTTP 4xx family ;). Let's take a deeper look at what are the other common errors and the possible reasons for that. Well, there are uncountable resources in the web on HTTP error codes and I need not add one more on top of it. Let me explain my stand then. I was getting complaint that a consumer of  one of my web service is getting a 403 error for quite some time. So thought why can't I group all these errors in my blog, for a reference. 

400 family of errors are client erros. Wikipedia says like this "The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents should display any included entity to the user."

Now let's look at each of these error codes.

400 Bad Request
The request cannot be fulfilled due to bad syntax.
401 Unauthorized
Similar to 403 Forbidden, but specifically for use when authentication is possible but has failed or not yet been provided.The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. See Basic access authentication and Digest access authentication.
402 Payment Required
Reserved for future use.[2] The original intention was that this code might be used as part of some form of digital cash or micropayment scheme, but that has not happened, and this code is not usually used. As an example of its use, however, Apple's MobileMe service generates a 402 error ("httpStatusCode:402" in the Mac OS X Console log) if the MobileMe account is delinquent.[citation needed]
403 Forbidden
The request was a legal request, but the server is refusing to respond to it.[2] Unlike a 401 Unauthorized response, authenticating will make no difference.[2]
404 Not Found
The requested resource could not be found but may be available again in the future.[2] Subsequent requests by the client are permissible.


I don't want to copy paste all the error codes in here. But let me look deeper into 403.

Below are the sub statuses of 403.
  • 403.1 - Execute access forbidden.
  • 403.2 - Read access forbidden.
  • 403.3 - Write access forbidden.
  • 403.4 - SSL required.
  • 403.5 - SSL 128 required.
  • 403.6 - IP address rejected.
  • 403.7 - Client certificate required.
  • 403.8 - Site access denied.
  • 403.9 - Too many users.
  • 403.10 - Invalid configuration.
  • 403.11 - Password change.
  • 403.12 - Mapper denied access.
  • 403.13 - Client certificate revoked.
  • 403.14 - Directory listing denied.
  • 403.15 - Client Access Licenses exceeded.
  • 403.16 - Client certificate is untrusted or invalid.
  • 403.17 - Client certificate has expired or is not yet valid.
  • 403.18 - Cannot execute request from that application pool.

The most common reason for 403 errors was when the directory browsing is disabled by the web server. You can see the sub status  403.14 where it's mentions directory listing is denies. This means you are trying to access a path to which you have no access. You should have a proper way using which you should try to hit this path. If it's due to "no directory browsing" (You can check if your url ends with a slash) then you need to find out the proper path.
Another case I got was 403.4 SSL required.  This is as the error suggest is due to incorrect implementation of SSL channel. install correct certificate and access the service over https should resolve this.

So,
 I get a HTTP 403.14 error when I tries to access my webservice. Now, you know that 403.14  Forbidden is due to the wrong path that I use. What I was doing, is just right clicking on the IIS manager and click on browse. Since this is a WCF service which is not developed by me , I first looked for the svc file. No it's not there! Then I searched for ServiceHost. Yes, I found the service host configuration in the app.config. And there it is


      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" >
        <serviceActivations>
          <add relativeAddress="MyService.svc"
            service="BlahBlahBlah.Service />    
        </serviceActivations>
      </serviceHostingEnvironment>

So I browsed,  http:\\localhost\MyService.svc.

Cool, the 403 error disappeared.

Did my service loaded correctly? No, I will explain it in another post.


Posted on Sunday, May 20, 2012 11:44 AM | Back to top


Comments on this post: HTTP 4xx errors

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Srijith Sarman | Powered by: GeeksWithBlogs.net