|
Title: HTTP 401 << AnyOne with HTTP ??? Post by: teamer on June 28, 2008, 12:45:23 PM hi friends ,i have some problems with the HTTP protocol , scually am not very familiar with HTTP , but i developed a software which has an option of retrieving webpage source code , but some pages are 401 forbidden , i tried to see the data that IE sends to the server when i input a username and password , acually i found that it just sends a normal GET request without any existance of a username or a password !!! can any one help me with this ? my question is how can i send a username and password to a 401 forbidden page ??? , thank you .
Title: Re: HTTP 401 << AnyOne with HTTP ??? Post by: shakuni on June 28, 2008, 04:19:33 PM Quote my question is how can i send a username and password to a 401 forbidden page This question should be restated as How should I send a username and password to a web resource so that I do not get 401. Actually the language of question shows that you have very superficial understanding of HTTP protocol. So go read rfc 2616 first, especially status codes that are described here- http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. Title: Re: HTTP 401 << AnyOne with HTTP ??? Post by: jimbob on June 30, 2008, 01:47:29 PM Usually what is being asked for it HTTP basic authentication. Your program will need to sent an Authorization: HTTP header, assuming you know the username and password. Take a look at the example on the Wikipedia page.
http://en.wikipedia.org/wiki/Basic_access_authentication Regards, Jimbob Title: Re: HTTP 401 << AnyOne with HTTP ??? Post by: teamer on July 04, 2008, 03:08:59 AM How should I send a username and password to a web resource so that I do not get 401. hahaha thanks shakuni , acually am very bad in english , second how you will know if that web resource would send you a 401 page or a normal 200 page if you didn't send the normal GET headers first !. but really thank you , and thank you jimbob too , that wiki was very usefull also , they should merge the 2 sources together somehow . Thanks Title: Re: HTTP 401 << AnyOne with HTTP ??? Post by: jimbob on July 04, 2008, 08:56:56 AM [quote author=teamer link=topic=2641.msg12197#msg12197
how you will know if that web resource would send you a 401 page or a normal 200 page if you didn't send the normal GET headers first !. [/quote] What happens is you send the normal GET request and the web servers sends back a 401 response. In the response headers there is information about the authenication required to access the page. If I access my home ADSL router for example I get offered Basic and Digest authentication for the realm SpeedTouch. Code: HTTP/1.x 401 Unauthorized Content-Length: 139 WWW-Authenticate: Digest realm="SpeedTouch", nonce="0732JT3ED:00-14-7F-F7-06-1F:480233:22601", qop="auth" WWW-Authenticate: Basic realm="SpeedTouch" This is how your web browser knows to prompt you for a username and password. When your browser receives the WWW-Authenticate header it prompts you for a username and password which it then sends along with the next request. Jimbob
Powered by SMF 1.1.18 |
SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com |