You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by shyam <sh...@iris-llc.com> on 2008/10/24 07:21:16 UTC

Problem connecting to IIS server asp .Net website with HttpClient

Hi,

 

I am using NTCredential class to login to an ASP.Net website.


I am getting a page which says Object moved.

 

But when I try to get that location I am not getting the correct page

.
I think it returns a 401 unauthorized error.


Please help me to find a way out.

 

This is very important for my project.

 

I am attaching the code snippet and stack trace below:

 

 

     HttpClient client = new HttpClient();

     NTCredentials creds = new
NTCredentials("username","password","www.myhost.com","Domain");

    client.getState().setCredentials(null, null, creds);

             

     PostMethod authpost = new PostMethod("https://www.
myhost.com/seclogin.asp?GOTO=Login");

     

     client.executeMethod(authpost);

     System.out.println("Login form post: " +
authpost.getStatusLine().toString());        

     System.out.println("Login form post: Body " +
authpost.getResponseBodyAsString()); 

     authpost.releaseConnection();

     

      Header header = authpost.getResponseHeader("location");

      String newuri = header.getValue();

      System.out.println("Redirect target: " + newuri);   

      

      GetMethod redirect = new GetMethod(newuri);

       redirect.setFollowRedirects(true);

       client.executeMethod(redirect);

 

       System.out.println("Redirect: " +
redirect.getStatusLine().toString());     

       System.out.println("Redirect: Body " +
redirect.getResponseBodyAsString()); 

       redirect.releaseConnection();

         

   *******

 

2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java version: 1.5.0_11

2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java vendor: Sun
Microsystems Inc.

2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java class path:
D:\eclipse\alloworkspace\screenscrapingapp\bin;D:\eclipse\alloworkspace\scre
enscrapingapp\lib\commons-codec-1.3.jar;D:\eclipse\alloworkspace\screenscrap
ingapp\lib\commons-fileupload-1.2.jar;D:\eclipse\alloworkspace\screenscrapin
gapp\lib\commons-fileupload-1.2-javadoc.jar;D:\eclipse\alloworkspace\screens
crapingapp\lib\commons-fileupload-1.2-sources.jar;D:\eclipse\alloworkspace\s
creenscrapingapp\lib\commons-io-1.3.1.jar;D:\eclipse\alloworkspace\screenscr
apingapp\lib\commons-io-1.3.1-javadoc.jar;D:\eclipse\alloworkspace\screenscr
apingapp\lib\commons-io-1.3.1-sources.jar;D:\eclipse\alloworkspace\screenscr
apingapp\lib\commons-logging-1.0.4.jar;D:\eclipse\alloworkspace\screenscrapi
ngapp\lib\commons-logging-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp
\lib\commons-logging-adapters-1.1.jar;D:\eclipse\alloworkspace\screenscrapin
gapp\lib\commons-logging-api.jar;D:\eclipse\alloworkspace\screenscrapingapp\
lib\commons-logging-api-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp\l
ib\spring.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\commons-lang.ja
r;D:\eclipse\alloworkspace\screenscrapingapp\lib\mysql-connector-java-5.0.4-
bin.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\PDFBox-0.7.3.jar;D:\e
clipse\alloworkspace\screenscrapingapp\lib\bcmail-jdk14-132.jar;D:\eclipse\a
lloworkspace\screenscrapingapp\lib\bcprov-jdk14-132.jar;D:\eclipse\alloworks
pace\screenscrapingapp\lib\FontBox-0.1.0-dev.jar;D:\eclipse\alloworkspace\sc
reenscrapingapp\lib\lucene-core-2.2.0.jar;D:\eclipse\alloworkspace\screenscr
apingapp\lib\lucene-demos-2.2.0.jar;D:\eclipse\alloworkspace\screenscrapinga
pp\lib\commons-httpclient-3.1.jar

2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system name:
Windows XP

2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system
architecture: x86

2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system version:
5.1

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SUN 1.5: SUN (DSA
key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom;
X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX
CertPathBuilder; LDAP, Collection CertStores)

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA
signature provider

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJCE 1.5: SunJCE Provider
(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE,
Diffie-Hellman, HMAC)

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos
v5)

2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL,
PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.useragent = Jakarta Commons-HttpClient/3.1

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.version = HTTP/1.1

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = default

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.element-charset = US-ASCII

2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.content-charset = ISO-8859-1

2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
http.method.retry-handler =
org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@3a6727

2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE,
dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss
z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy
HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z,
EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]

2008/10/24 10:28:28:156 IST [DEBUG] HttpConnection - Open connection to
www.myhost.com:443

2008/10/24 10:28:33:875 IST [DEBUG] header - >> "POST
/seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"

2008/10/24 10:28:33:875 IST [DEBUG] HttpMethodBase - Adding Host request
header

2008/10/24 10:28:33:906 IST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"

2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Host:
www.myhost.com[\r][\n]"

2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Content-Length: 0[\r][\n]"

2008/10/24 10:28:33:906 IST [DEBUG] header - >> "[\r][\n]"

2008/10/24 10:28:33:906 IST [DEBUG] EntityEnclosingMethod - Request body has
not been specified

2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Length:
1656[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Type:
text/html[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "Server:
Microsoft-IIS/6.0[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "WWW-Authenticate: Basic
realm="DOMAIN"[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "X-Powered-By:
ASP.NET[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
04:56:34 GMT[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] header - << "[\r][\n]"

2008/10/24 10:28:35:296 IST [DEBUG] HttpMethodDirector - Authorization
required

2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Supported
authentication schemes in the order of preference: [ntlm, digest, basic]

2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
ntlm authentication scheme not available

2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
digest authentication scheme not available

2008/10/24 10:28:35:312 IST [INFO] AuthChallengeProcessor - basic
authentication scheme selected

2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Using
authentication scheme: basic

2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Authorization
challenge processed

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authentication
scope: BASIC `DOMAIN`@www.myhost.com:443

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Retry
authentication

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Resorting to protocol
version default close connection policy

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1

2008/10/24 10:28:35:312 IST [DEBUG] HttpConnection - Connection is locked.
Call to releaseConnection() ignored.

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authenticating with
BASIC `DOMAIN`@www.myhost.com:443

2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodParams - Credential charset
not configured, using HTTP element charset

2008/10/24 10:28:35:328 IST [DEBUG] header - >> "POST
/seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"

2008/10/24 10:28:35:328 IST [DEBUG] HttpMethodBase - Adding Host request
header

2008/10/24 10:28:35:328 IST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"

2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Content-Length: 0[\r][\n]"

2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Authorization: Basic
aXJpc21lZHM6dmM5MjU=[\r][\n]"

2008/10/24 10:28:35:343 IST [DEBUG] header - >> "Host:
www.myhost.com[\r][\n]"

2008/10/24 10:28:35:343 IST [DEBUG] header - >> "[\r][\n]"

2008/10/24 10:28:35:343 IST [DEBUG] EntityEnclosingMethod - Request body has
not been specified

2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
moved[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
moved[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
04:56:35 GMT[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Server:
Microsoft-IIS/6.0[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "X-Powered-By:
ASP.NET[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "cache-control:
private[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "pragma: no-cache[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Location:
https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489[\r][
\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Length:
200[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Type:
text/html[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Expires: Fri, 24 Oct 2008
04:56:34 GMT[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Set-Cookie:
ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "Cache-control:
private[\r][\n]"

2008/10/24 10:28:35:703 IST [DEBUG] header - << "[\r][\n]"Login form post:
HTTP/1.1 302 Object moved

Login form post: Req  Cookie null

Login form post: QS GOTO=Login

Login form post: Res  Cookie Set-Cookie:
ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/

 

Login form post: Location Location:
https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489

 

Login form post: Path /secure_oa.asp

 

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/"

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodDirector - Redirect required

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Buffering response body

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Resorting to protocol
version default close connection policy

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1

2008/10/24 10:28:35:703 IST [DEBUG] HttpConnection - Releasing connection
back to connection manager.Login form post: Body <head><title>Object
moved</title></head>

<body><h1>Object Moved</h1>This object may be found <a
HREF="https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E48
9">here</a>.</body>

 

Logon cookies:

- ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK

Redirect target:
https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489

 

2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1

2008/10/24 10:28:35:718 IST [DEBUG] header - >> "GET
/secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"

2008/10/24 10:28:35:718 IST [DEBUG] HttpMethodBase - Adding Host request
header

2008/10/24 10:28:35:718 IST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"

2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Host:
www.myhost.com[\r][\n]"

2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Cookie: $Version=0;
ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"

2008/10/24 10:28:35:718 IST [DEBUG] header - >> "[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Length:
1656[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Type:
text/html[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "Server:
Microsoft-IIS/6.0[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "WWW-Authenticate: Basic
realm="OFFICEALLY.COM"[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "X-Powered-By:
ASP.NET[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
04:56:34 GMT[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] header - << "[\r][\n]"

2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authorization
required

2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Supported
authentication schemes in the order of preference: [ntlm, digest, basic]

2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
ntlm authentication scheme not available

2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
digest authentication scheme not available

2008/10/24 10:28:36:031 IST [INFO] AuthChallengeProcessor - basic
authentication scheme selected

2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Using
authentication scheme: basic

2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Authorization
challenge processed

2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authentication
scope: BASIC 'OFFICEALLY.COM'@www.myhost.com:443

2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Retry
authentication

2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodBase - Resorting to protocol
version default close connection policy

2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1

2008/10/24 10:28:36:046 IST [DEBUG] HttpConnection - Connection is locked.
Call to releaseConnection() ignored.

2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodDirector - Authenticating with
BASIC 'DOMAIN`@www.myhost.com:443

2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodParams - Credential charset
not configured, using HTTP element charset

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "GET
/secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"

2008/10/24 10:28:36:062 IST [DEBUG] HttpMethodBase - Adding Host request
header

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Authorization: Basic
aXJpc21lZHM6dmM5MjU=[\r][\n]"

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Host:
www.myhost.com[\r][\n]"

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Cookie: $Version=0;
ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"

2008/10/24 10:28:36:062 IST [DEBUG] header - >> "[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
04:56:35 GMT[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Server:
Microsoft-IIS/6.0[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "X-Powered-By:
ASP.NET[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Length:
787[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Type:
text/html[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
OA%5FLoginAttempt=1; path=/[\r][\n]"Redirect: HTTP/1.1 200 OK

Redirect: Req Cookie Cookie: $Version=0;
ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/

 

Redirect: QS OA=2221D63B03784D7C803812BD1D00E489

Redirect: Res Cookie set-cookie: OA%5FLoginAttempt=1; path=/,
OASID=2221D63B03784D7C803812BD1D00E489; path=/

 

Redirect: Location null

Redirect: Path /seclogin.asp

 

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
OASID=2221D63B03784D7C803812BD1D00E489; path=/[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "Cache-control:
private[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] header - << "[\r][\n]"

2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; OA%5FLoginAttempt=1; $Path=/"

2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; OASID=2221D63B03784D7C803812BD1D00E489; $Path=/"

2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Buffering response
bodyRedirect: Body 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

      <title></title>   

      <META HTTP-EQUIV=Refresh CONTENT="0;
URL=https://www.myhost.com/sec.asp">

      <META http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">      

</head>

<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
bgcolor="#ffffff">

      <table border="0" cellpadding="0" cellspacing="0" width="100%">

            <tr>              

                  <td>

                        <table border="0" cellspacing="0" cellpadding="0"
width="100%">

                              <tr>

                                    <td width="225"><img
src="imagesV2/oalogo.gif" width="159" height="77" alt="" border="0"></td>


                                    <td align="left" width="1099" ></td>

                              </tr>

                        </table>                

                  </td>

            </tr>

      </table>

</body>

</html>

 

2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Resorting to protocol
version default close connection policy

2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1

2008/10/24 10:28:36:390 IST [DEBUG] HttpConnection - Releasing connection
back to connection manager.

2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1

 

 

Thanks for Reading :-)

 

Shyam

 


RE: Problem connecting to IIS server asp .Net website withHttpClient

Posted by shyam <sh...@iris-llc.com>.
Hi Oleg,

Thank you very much for your reply.

The Browser compatibility link was very useful.

But my problem was different.

There was a link in the page I was getting.
It was the same link without any query string
https://www.myhost.com/sec.asp.

I just had to call get method again for this link and I got the correct
page.

Again I didn't had to use NTCredentials also.

httpclient.getState().setCredentials(new AuthScope("www.myhost.com", 443,
AuthScope.ANY_REALM),  new UsernamePasswordCredentials("user","pass")); 

was enough for this.

I got complicated thinking about NTLM, IIS and all...

Thanks for your help.
HttpClient is fabulous.

Regards,
Shyam


-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Saturday, October 25, 2008 6:18 PM
To: HttpClient User Discussion
Subject: Re: Problem connecting to IIS server asp .Net website
withHttpClient

On Fri, 2008-10-24 at 10:51 +0530, shyam wrote:
> Hi,
> 
>  
> 
> I am using NTCredential class to login to an ASP.Net website.
> 
> 
> I am getting a page which says Object moved.
> 
>  
> 
> But when I try to get that location I am not getting the correct page
> 
> .
> I think it returns a 401 unauthorized error.
> 
> 
> Please help me to find a way out.
> 
>  
> 
> This is very important for my project.
> 
>  
> 
> I am attaching the code snippet and stack trace below:
> 
>  

I think this problem is session cookie related. Try using browser
compatibility cookie spec + 'http.protocol.single-cookie-header'
parameter. 

http://hc.apache.org/httpclient-3.x/cookies.html#Browser%20Compatibility

Oleg

> 
> 
> 
>      HttpClient client = new HttpClient();
> 
>      NTCredentials creds = new
> NTCredentials("username","password","www.myhost.com","Domain");
> 
>     client.getState().setCredentials(null, null, creds);
> 
>              
> 
>      PostMethod authpost = new PostMethod("https://www.
> myhost.com/seclogin.asp?GOTO=Login");
> 
>      
> 
>      client.executeMethod(authpost);
> 
>      System.out.println("Login form post: " +
> authpost.getStatusLine().toString());        
> 
>      System.out.println("Login form post: Body " +
> authpost.getResponseBodyAsString()); 
> 
>      authpost.releaseConnection();
> 
>      
> 
>       Header header = authpost.getResponseHeader("location");
> 
>       String newuri = header.getValue();
> 
>       System.out.println("Redirect target: " + newuri);   
> 
>       
> 
>       GetMethod redirect = new GetMethod(newuri);
> 
>        redirect.setFollowRedirects(true);
> 
>        client.executeMethod(redirect);
> 
>  
> 
>        System.out.println("Redirect: " +
> redirect.getStatusLine().toString());     
> 
>        System.out.println("Redirect: Body " +
> redirect.getResponseBodyAsString()); 
> 
>        redirect.releaseConnection();
> 
>          
> 
>    *******
> 
>  
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java version: 1.5.0_11
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java vendor: Sun
> Microsystems Inc.
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java class path:
>
D:\eclipse\alloworkspace\screenscrapingapp\bin;D:\eclipse\alloworkspace\scre
>
enscrapingapp\lib\commons-codec-1.3.jar;D:\eclipse\alloworkspace\screenscrap
>
ingapp\lib\commons-fileupload-1.2.jar;D:\eclipse\alloworkspace\screenscrapin
>
gapp\lib\commons-fileupload-1.2-javadoc.jar;D:\eclipse\alloworkspace\screens
>
crapingapp\lib\commons-fileupload-1.2-sources.jar;D:\eclipse\alloworkspace\s
>
creenscrapingapp\lib\commons-io-1.3.1.jar;D:\eclipse\alloworkspace\screenscr
>
apingapp\lib\commons-io-1.3.1-javadoc.jar;D:\eclipse\alloworkspace\screenscr
>
apingapp\lib\commons-io-1.3.1-sources.jar;D:\eclipse\alloworkspace\screenscr
>
apingapp\lib\commons-logging-1.0.4.jar;D:\eclipse\alloworkspace\screenscrapi
>
ngapp\lib\commons-logging-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp
>
\lib\commons-logging-adapters-1.1.jar;D:\eclipse\alloworkspace\screenscrapin
>
gapp\lib\commons-logging-api.jar;D:\eclipse\alloworkspace\screenscrapingapp\
>
lib\commons-logging-api-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp\l
>
ib\spring.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\commons-lang.ja
>
r;D:\eclipse\alloworkspace\screenscrapingapp\lib\mysql-connector-java-5.0.4-
>
bin.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\PDFBox-0.7.3.jar;D:\e
>
clipse\alloworkspace\screenscrapingapp\lib\bcmail-jdk14-132.jar;D:\eclipse\a
>
lloworkspace\screenscrapingapp\lib\bcprov-jdk14-132.jar;D:\eclipse\alloworks
>
pace\screenscrapingapp\lib\FontBox-0.1.0-dev.jar;D:\eclipse\alloworkspace\sc
>
reenscrapingapp\lib\lucene-core-2.2.0.jar;D:\eclipse\alloworkspace\screenscr
>
apingapp\lib\lucene-demos-2.2.0.jar;D:\eclipse\alloworkspace\screenscrapinga
> pp\lib\commons-httpclient-3.1.jar
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system name:
> Windows XP
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system
> architecture: x86
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system version:
> 5.1
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SUN 1.5: SUN (DSA
> key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom;
> X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX
> CertPathBuilder; LDAP, Collection CertStores)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA
> signature provider
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
> provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJCE 1.5: SunJCE
Provider
> (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE,
> Diffie-Hellman, HMAC)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJGSS 1.0: Sun
(Kerberos
> v5)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
> provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL,
> PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.useragent = Jakarta Commons-HttpClient/3.1
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.version = HTTP/1.1
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.connection-manager.class = class
> org.apache.commons.httpclient.SimpleHttpConnectionManager
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.cookie-policy = default
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.element-charset = US-ASCII
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.content-charset = ISO-8859-1
> 
> 2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
> http.method.retry-handler =
> org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@3a6727
> 
> 2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
> http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
> HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE,
> dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy
HH:mm:ss
> z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy
> HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z,
> EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
> 
> 2008/10/24 10:28:28:156 IST [DEBUG] HttpConnection - Open connection to
> www.myhost.com:443
> 
> 2008/10/24 10:28:33:875 IST [DEBUG] header - >> "POST
> /seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:33:875 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Content-Length:
0[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] EntityEnclosingMethod - Request body
has
> not been specified
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Length:
> 1656[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "WWW-Authenticate: Basic
> realm="DOMAIN"[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] HttpMethodDirector - Authorization
> required
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
> ntlm authentication scheme not available
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
> digest authentication scheme not available
> 
> 2008/10/24 10:28:35:312 IST [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Authorization
> challenge processed
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authentication
> scope: BASIC `DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Retry
> authentication
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpConnection - Connection is locked.
> Call to releaseConnection() ignored.
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authenticating
with
> BASIC `DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodParams - Credential charset
> not configured, using HTTP element charset
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "POST
> /seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Content-Length:
0[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Authorization: Basic
> aXJpc21lZHM6dmM5MjU=[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] EntityEnclosingMethod - Request body
has
> not been specified
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
> moved[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
> moved[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:35 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "pragma: no-cache[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Location:
>
https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489[\r][
> \n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Length:
> 200[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Expires: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Set-Cookie:
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "[\r][\n]"Login form post:
> HTTP/1.1 302 Object moved
> 
> Login form post: Req  Cookie null
> 
> Login form post: QS GOTO=Login
> 
> Login form post: Res  Cookie Set-Cookie:
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/
> 
>  
> 
> Login form post: Location Location:
> https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489
> 
>  
> 
> Login form post: Path /secure_oa.asp
> 
>  
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodDirector - Redirect required
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Buffering response
body
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpConnection - Releasing connection
> back to connection manager.Login form post: Body <head><title>Object
> moved</title></head>
> 
> <body><h1>Object Moved</h1>This object may be found <a
>
HREF="https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E48
> 9">here</a>.</body>
> 
>  
> 
> Logon cookies:
> 
> - ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK
> 
> Redirect target:
> https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489
> 
>  
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Default charset used:
> ISO-8859-1
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "GET
> /secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Length:
> 1656[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "WWW-Authenticate: Basic
> realm="OFFICEALLY.COM"[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authorization
> required
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
> ntlm authentication scheme not available
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
> digest authentication scheme not available
> 
> 2008/10/24 10:28:36:031 IST [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Authorization
> challenge processed
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authentication
> scope: BASIC 'OFFICEALLY.COM'@www.myhost.com:443
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Retry
> authentication
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpConnection - Connection is locked.
> Call to releaseConnection() ignored.
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodDirector - Authenticating
with
> BASIC 'DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodParams - Credential charset
> not configured, using HTTP element charset
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "GET
> /secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Authorization: Basic
> aXJpc21lZHM6dmM5MjU=[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:35 GMT[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Length:
> 787[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
> OA%5FLoginAttempt=1; path=/[\r][\n]"Redirect: HTTP/1.1 200 OK
> 
> Redirect: Req Cookie Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/
> 
>  
> 
> Redirect: QS OA=2221D63B03784D7C803812BD1D00E489
> 
> Redirect: Res Cookie set-cookie: OA%5FLoginAttempt=1; path=/,
> OASID=2221D63B03784D7C803812BD1D00E489; path=/
> 
>  
> 
> Redirect: Location null
> 
> Redirect: Path /seclogin.asp
> 
>  
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
> OASID=2221D63B03784D7C803812BD1D00E489; path=/[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; OA%5FLoginAttempt=1; $Path=/"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; OASID=2221D63B03784D7C803812BD1D00E489; $Path=/"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Buffering response
> bodyRedirect: Body 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> 
> <html>
> 
> <head>
> 
>       <title></title>   
> 
>       <META HTTP-EQUIV=Refresh CONTENT="0;
> URL=https://www.myhost.com/sec.asp">
> 
>       <META http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">      
> 
> </head>
> 
> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
> bgcolor="#ffffff">
> 
>       <table border="0" cellpadding="0" cellspacing="0" width="100%">
> 
>             <tr>              
> 
>                   <td>
> 
>                         <table border="0" cellspacing="0" cellpadding="0"
> width="100%">
> 
>                               <tr>
> 
>                                     <td width="225"><img
> src="imagesV2/oalogo.gif" width="159" height="77" alt="" border="0"></td>
> 
> 
>                                     <td align="left" width="1099" ></td>
> 
>                               </tr>
> 
>                         </table>                
> 
>                   </td>
> 
>             </tr>
> 
>       </table>
> 
> </body>
> 
> </html>
> 
>  
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpConnection - Releasing connection
> back to connection manager.
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Default charset used:
> ISO-8859-1
> 
>  
> 
> 
> 
> Thanks for Reading :-)
> 
>  
> 
> Shyam
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Problem connecting to IIS server asp .Net website with HttpClient

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-10-24 at 10:51 +0530, shyam wrote:
> Hi,
> 
>  
> 
> I am using NTCredential class to login to an ASP.Net website.
> 
> 
> I am getting a page which says Object moved.
> 
>  
> 
> But when I try to get that location I am not getting the correct page
> 
> .
> I think it returns a 401 unauthorized error.
> 
> 
> Please help me to find a way out.
> 
>  
> 
> This is very important for my project.
> 
>  
> 
> I am attaching the code snippet and stack trace below:
> 
>  

I think this problem is session cookie related. Try using browser
compatibility cookie spec + 'http.protocol.single-cookie-header'
parameter. 

http://hc.apache.org/httpclient-3.x/cookies.html#Browser%20Compatibility

Oleg

> 
> 
> 
>      HttpClient client = new HttpClient();
> 
>      NTCredentials creds = new
> NTCredentials("username","password","www.myhost.com","Domain");
> 
>     client.getState().setCredentials(null, null, creds);
> 
>              
> 
>      PostMethod authpost = new PostMethod("https://www.
> myhost.com/seclogin.asp?GOTO=Login");
> 
>      
> 
>      client.executeMethod(authpost);
> 
>      System.out.println("Login form post: " +
> authpost.getStatusLine().toString());        
> 
>      System.out.println("Login form post: Body " +
> authpost.getResponseBodyAsString()); 
> 
>      authpost.releaseConnection();
> 
>      
> 
>       Header header = authpost.getResponseHeader("location");
> 
>       String newuri = header.getValue();
> 
>       System.out.println("Redirect target: " + newuri);   
> 
>       
> 
>       GetMethod redirect = new GetMethod(newuri);
> 
>        redirect.setFollowRedirects(true);
> 
>        client.executeMethod(redirect);
> 
>  
> 
>        System.out.println("Redirect: " +
> redirect.getStatusLine().toString());     
> 
>        System.out.println("Redirect: Body " +
> redirect.getResponseBodyAsString()); 
> 
>        redirect.releaseConnection();
> 
>          
> 
>    *******
> 
>  
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java version: 1.5.0_11
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java vendor: Sun
> Microsystems Inc.
> 
> 2008/10/24 10:28:27:796 IST [DEBUG] HttpClient - Java class path:
> D:\eclipse\alloworkspace\screenscrapingapp\bin;D:\eclipse\alloworkspace\scre
> enscrapingapp\lib\commons-codec-1.3.jar;D:\eclipse\alloworkspace\screenscrap
> ingapp\lib\commons-fileupload-1.2.jar;D:\eclipse\alloworkspace\screenscrapin
> gapp\lib\commons-fileupload-1.2-javadoc.jar;D:\eclipse\alloworkspace\screens
> crapingapp\lib\commons-fileupload-1.2-sources.jar;D:\eclipse\alloworkspace\s
> creenscrapingapp\lib\commons-io-1.3.1.jar;D:\eclipse\alloworkspace\screenscr
> apingapp\lib\commons-io-1.3.1-javadoc.jar;D:\eclipse\alloworkspace\screenscr
> apingapp\lib\commons-io-1.3.1-sources.jar;D:\eclipse\alloworkspace\screenscr
> apingapp\lib\commons-logging-1.0.4.jar;D:\eclipse\alloworkspace\screenscrapi
> ngapp\lib\commons-logging-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp
> \lib\commons-logging-adapters-1.1.jar;D:\eclipse\alloworkspace\screenscrapin
> gapp\lib\commons-logging-api.jar;D:\eclipse\alloworkspace\screenscrapingapp\
> lib\commons-logging-api-1.1.jar;D:\eclipse\alloworkspace\screenscrapingapp\l
> ib\spring.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\commons-lang.ja
> r;D:\eclipse\alloworkspace\screenscrapingapp\lib\mysql-connector-java-5.0.4-
> bin.jar;D:\eclipse\alloworkspace\screenscrapingapp\lib\PDFBox-0.7.3.jar;D:\e
> clipse\alloworkspace\screenscrapingapp\lib\bcmail-jdk14-132.jar;D:\eclipse\a
> lloworkspace\screenscrapingapp\lib\bcprov-jdk14-132.jar;D:\eclipse\alloworks
> pace\screenscrapingapp\lib\FontBox-0.1.0-dev.jar;D:\eclipse\alloworkspace\sc
> reenscrapingapp\lib\lucene-core-2.2.0.jar;D:\eclipse\alloworkspace\screenscr
> apingapp\lib\lucene-demos-2.2.0.jar;D:\eclipse\alloworkspace\screenscrapinga
> pp\lib\commons-httpclient-3.1.jar
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system name:
> Windows XP
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system
> architecture: x86
> 
> 2008/10/24 10:28:27:812 IST [DEBUG] HttpClient - Operating system version:
> 5.1
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SUN 1.5: SUN (DSA
> key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom;
> X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX
> CertPathBuilder; LDAP, Collection CertStores)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA
> signature provider
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
> provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJCE 1.5: SunJCE Provider
> (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE,
> Diffie-Hellman, HMAC)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos
> v5)
> 
> 2008/10/24 10:28:28:031 IST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
> provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL,
> PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.useragent = Jakarta Commons-HttpClient/3.1
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.version = HTTP/1.1
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.connection-manager.class = class
> org.apache.commons.httpclient.SimpleHttpConnectionManager
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.cookie-policy = default
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.element-charset = US-ASCII
> 
> 2008/10/24 10:28:28:046 IST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.content-charset = ISO-8859-1
> 
> 2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
> http.method.retry-handler =
> org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@3a6727
> 
> 2008/10/24 10:28:28:062 IST [DEBUG] DefaultHttpParams - Set parameter
> http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
> HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE,
> dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss
> z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy
> HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z,
> EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
> 
> 2008/10/24 10:28:28:156 IST [DEBUG] HttpConnection - Open connection to
> www.myhost.com:443
> 
> 2008/10/24 10:28:33:875 IST [DEBUG] header - >> "POST
> /seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:33:875 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "Content-Length: 0[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:33:906 IST [DEBUG] EntityEnclosingMethod - Request body has
> not been specified
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Length:
> 1656[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "WWW-Authenticate: Basic
> realm="DOMAIN"[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:35:296 IST [DEBUG] HttpMethodDirector - Authorization
> required
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
> ntlm authentication scheme not available
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Challenge for
> digest authentication scheme not available
> 
> 2008/10/24 10:28:35:312 IST [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] AuthChallengeProcessor - Authorization
> challenge processed
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authentication
> scope: BASIC `DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Retry
> authentication
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpConnection - Connection is locked.
> Call to releaseConnection() ignored.
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodDirector - Authenticating with
> BASIC `DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:35:312 IST [DEBUG] HttpMethodParams - Credential charset
> not configured, using HTTP element charset
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "POST
> /seclogin.asp?GOTO=Login HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Content-Length: 0[\r][\n]"
> 
> 2008/10/24 10:28:35:328 IST [DEBUG] header - >> "Authorization: Basic
> aXJpc21lZHM6dmM5MjU=[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:35:343 IST [DEBUG] EntityEnclosingMethod - Request body has
> not been specified
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
> moved[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "HTTP/1.1 302 Object
> moved[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:35 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "pragma: no-cache[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Location:
> https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489[\r][
> \n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Length:
> 200[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Expires: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Set-Cookie:
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "Cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] header - << "[\r][\n]"Login form post:
> HTTP/1.1 302 Object moved
> 
> Login form post: Req  Cookie null
> 
> Login form post: QS GOTO=Login
> 
> Login form post: Res  Cookie Set-Cookie:
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; path=/
> 
>  
> 
> Login form post: Location Location:
> https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489
> 
>  
> 
> Login form post: Path /secure_oa.asp
> 
>  
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/"
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodDirector - Redirect required
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Buffering response body
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpConnection - Releasing connection
> back to connection manager.Login form post: Body <head><title>Object
> moved</title></head>
> 
> <body><h1>Object Moved</h1>This object may be found <a
> HREF="https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E48
> 9">here</a>.</body>
> 
>  
> 
> Logon cookies:
> 
> - ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK
> 
> Redirect target:
> https://www.myhost.com/seclogin.asp?OA=2221D63B03784D7C803812BD1D00E489
> 
>  
> 
> 2008/10/24 10:28:35:703 IST [DEBUG] HttpMethodBase - Default charset used:
> ISO-8859-1
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "GET
> /secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"
> 
> 2008/10/24 10:28:35:718 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "HTTP/1.1 401
> Unauthorized[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Length:
> 1656[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "WWW-Authenticate: Basic
> realm="OFFICEALLY.COM"[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:34 GMT[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authorization
> required
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
> ntlm authentication scheme not available
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Challenge for
> digest authentication scheme not available
> 
> 2008/10/24 10:28:36:031 IST [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] AuthChallengeProcessor - Authorization
> challenge processed
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Authentication
> scope: BASIC 'OFFICEALLY.COM'@www.myhost.com:443
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodDirector - Retry
> authentication
> 
> 2008/10/24 10:28:36:031 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpConnection - Connection is locked.
> Call to releaseConnection() ignored.
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodDirector - Authenticating with
> BASIC 'DOMAIN`@www.myhost.com:443
> 
> 2008/10/24 10:28:36:046 IST [DEBUG] HttpMethodParams - Credential charset
> not configured, using HTTP element charset
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "GET
> /secure_login.asp?OA=2221D63B03784D7C803812BD1D00E489 HTTP/1.1[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] HttpMethodBase - Adding Host request
> header
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Authorization: Basic
> aXJpc21lZHM6dmM5MjU=[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Host:
> www.myhost.com[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/[\r][\n]"
> 
> 2008/10/24 10:28:36:062 IST [DEBUG] header - >> "[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Date: Fri, 24 Oct 2008
> 04:56:35 GMT[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Server:
> Microsoft-IIS/6.0[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "X-Powered-By:
> ASP.NET[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Length:
> 787[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
> OA%5FLoginAttempt=1; path=/[\r][\n]"Redirect: HTTP/1.1 200 OK
> 
> Redirect: Req Cookie Cookie: $Version=0;
> ASPSESSIONIDCCRCCTAC=EBHJFFAALIFOHMGAJKOLDFKK; $Path=/
> 
>  
> 
> Redirect: QS OA=2221D63B03784D7C803812BD1D00E489
> 
> Redirect: Res Cookie set-cookie: OA%5FLoginAttempt=1; path=/,
> OASID=2221D63B03784D7C803812BD1D00E489; path=/
> 
>  
> 
> Redirect: Location null
> 
> Redirect: Path /seclogin.asp
> 
>  
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Set-Cookie:
> OASID=2221D63B03784D7C803812BD1D00E489; path=/[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "Cache-control:
> private[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] header - << "[\r][\n]"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; OA%5FLoginAttempt=1; $Path=/"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=0; OASID=2221D63B03784D7C803812BD1D00E489; $Path=/"
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Buffering response
> bodyRedirect: Body 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> 
> <html>
> 
> <head>
> 
>       <title></title>   
> 
>       <META HTTP-EQUIV=Refresh CONTENT="0;
> URL=https://www.myhost.com/sec.asp">
> 
>       <META http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">      
> 
> </head>
> 
> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
> bgcolor="#ffffff">
> 
>       <table border="0" cellpadding="0" cellspacing="0" width="100%">
> 
>             <tr>              
> 
>                   <td>
> 
>                         <table border="0" cellspacing="0" cellpadding="0"
> width="100%">
> 
>                               <tr>
> 
>                                     <td width="225"><img
> src="imagesV2/oalogo.gif" width="159" height="77" alt="" border="0"></td>
> 
> 
>                                     <td align="left" width="1099" ></td>
> 
>                               </tr>
> 
>                         </table>                
> 
>                   </td>
> 
>             </tr>
> 
>       </table>
> 
> </body>
> 
> </html>
> 
>  
> 
> 2008/10/24 10:28:36:375 IST [DEBUG] HttpMethodBase - Resorting to protocol
> version default close connection policy
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Should NOT close
> connection, using HTTP/1.1
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpConnection - Releasing connection
> back to connection manager.
> 
> 2008/10/24 10:28:36:390 IST [DEBUG] HttpMethodBase - Default charset used:
> ISO-8859-1
> 
>  
> 
> 
> 
> Thanks for Reading :-)
> 
>  
> 
> Shyam
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org