views:

63

answers:

1

Hello every one, I am getting a problem while fetching data. Its giving CFHTTPMessageGetResponseStatusCode(response) as 302 . can any one help me to solve this problem. Thanks in advance,

+3  A: 

Straight from the horse's mouth (RFC2616, sec.10.3.3):

302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.

In other words, it's a redirection: "what you're looking for is over there right now." Check the Location: response header - that's your new URL you need to retrieve.

Piskvor
Thanks Piskvor for your response. I have done as you suggested. after doing with the new URL it is giving me some html data with response 200. Its not asking for authentication challenge. Can you tell me where the problem is??am i missing something?
"200 OK" means "you wanted this data, here it is". That is the correct behavior - I don't see anything about authentication in your question.
Piskvor
Yes, But the url which it is redirecting to is a login page. so I am supposed to get response 401 or 407. Instead it is giving the current page's html data...
If you're using HTTP auth, then you're probably getting redirected somewhere else than your login page, or you're already logged in.If you're using a login page instead of HTTP auth, you should be getting a 200 response with your login page. Could you provide a bit more info in the question?
Piskvor
I will explain you my requirement in detail. I have to get some xml data from the server page. But that page can be accessed only after logging in. I am directly calling that page where my xml file is there. So it is redirected to the login page, as I haven't logged in yet. Then I tried to access the login page, I am expecting it to throw status of 401 or 407. But I am getting status 200, how can I supply the authentication information now.
There is no HTTP authentication scheme for form based login and cookies (yet), so the server is simply responding with 200, and the client needs to figure out that this is a login form. Known issue, for many years. See http://www.w3.org/html/wg/tracker/issues/13.
Julian Reschke
Many Thanks Julian.