0

我正在尝试实现以下代码:

NSURL *url = [NSURL URLWithString:@"https://login.XXX.com/security/xxxforms//
logonchalnp.fcc?TYPE=33554433&REALMOID=06-95b0f0c8-198a-1039-b583
83b02659fd47&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=owa5&TARGET=-SM- 
HTTPS%3a%2f%2fowa%2exxx%2ecom%2f"];

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setPostValue:@"XXX" forKey:@"USER"];
[request setPostValue:@"XXX" forKey:@"PASSWORD"];
[request startSynchronous];

NSURLResponse *response;
NSError *error;
NSData *urlData = [NSURLConnection sendSynchronousRequest:request
                                        returningResponse:&response 
                                                    error:&error];
NSString *str=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(@"Login response: is %@", str);

该网站的相关内容是:

<form NAME="Login" METHOD="POST" action="/forms/logonchal_l10question.jsp">
<INPUT TYPE=HIDDEN NAME="SMENC" VALUE="ISO-8859-1">
<INPUT type=HIDDEN name="SMLOCALE" value="US-EN">
<center>

<!-- outer table with border -->
<table width="50%" border="1" cellpadding="0" cellspacing="0" align=center>
<tr> 
<td>    
<!-- Login table -->          
<table WIDTH="100%" HEIGHT=200 class="platportletLightBg" border=0 cellpadding=0
cellspacing=0 >

<tr HEIGHT="30" class="platportletHeaderBg">
<td valign=center height=40 align=center colspan=4 >
        <b class="d_banHeader">Please Login</b>
      </td>
    </tr>

    <tr> <td colspan=4 height=20> <font size=1> &nbsp; </font> </td> </tr>

    <tr align="center">
      <td WIDTH=20 >&nbsp;</td>
      <td ALIGN="LEFT" > 
            <b class="customappSubhead"> Username: </b>
      </td>
      <td align=center >
            <input type="text" name="USER" size="30" AUTOCOMPLETE=OFF>
          </td>
      <td WIDTH=20 >&nbsp;</td>
    </tr>

    <tr> <td colspan=4 height=5> <font size=1> &nbsp; </font> </td> </tr>

    <tr align="center" >
      <td WIDTH=20 >&nbsp;</td>
      <td align=left>
            <b class="customappSubhead"> Password: </b>
      </td>
      <td>
        <input type="password" name="PASSWORD" size="30">
      </td>
      <td WIDTH=20 >&nbsp;</td>
    </tr>

    <tr> <td colspan=4 height=20> <font size=1> &nbsp; </font> </td> </tr>

    <tr>
      <td colspan=4 NOWRAP WIDTH="50%" HEIGHT="25" align="CENTER">
          <input type=hidden name=target value="HTTPS://owa.xxx.com/">
          <input type=hidden name=smquerydata value="">
          <input type=hidden name=smauthreason value="0">
          <input type=hidden name=smagentname value="owa5">
          <input type=hidden name=postpreservationdata value="">
          <input type="button" value="Login" onClick="submitForm();">
      </td>
    </tr>

预期响应:当使用适当的用户名/密码从浏览器手动登录时,网页将重定向到安全问题页面。如果问题被成功回答,它将进入另一个基于 Web 的应用程序的登录页面。

就代码而言,它成功登录到初始页面,但绕过安全问题页面并直接进入辅助登录页面。从那里开始,基于 Web 的应用程序登录将(显然?)不成功。我知道它至少正确地使用了初始用户和密码,因为如果输入了错误的值(错误的凭据通知)它会失败。如果输入正确的值,UIWebView 也将准确显示辅助登录页面。附带说明:当 URL 直接输入浏览器时,无法访问此辅助登录页面。

问题:请求知道我在这里是否缺少任何重定向?我如何触发 action="/forms/lognchal_l10question.jsp" 我相信登录问题是在哪里生成和呈现的?

任何帮助是极大的赞赏。

4

1 回答 1

0

Could you please let me know where i can find the file where

below NSURL*url is configured

 NSURL *url = [NSURL URLWithString:@"https://login.XXX.com/security/xxxforms//
 logonchalnp.fcc?TYPE=33554433&REALMOID=06-95b0f0c8-198a-1039-b583
 83b02659fd47&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=owa5&
 TARGET=-SM-HTTPS%3a%2f%2fowa%2exxx%2ecom%2f"];

We are using Sun One WebServer.

Could you please give me the location and name of the file where I can find the file. I dont have idea which OS they are using(Solaris/Unix).

于 2013-11-17T15:36:35.300 回答