0

我是 webclient 进程的新手。这是我想从我的 Web 应用程序登录的 asp 页面:-

http://localhost/alis/services.asp

<TABLE width="1261">
  <FORM action="sign_handler_control_id.asp" onsubmit="return LoginForm_Validation(this)" name="TheForm" method="post" >

  <TBODY>
   <TR>
  <TH width="700" valign="middle" align="left"><FONT color="#000000"><U><FONT color="#000000" face="Arial" size="+1">Pengguna yang telah mendaftar, sila masukkan Kod Agensi, ID Pengguna dan Katalaluan</FONT></U><FONT color="#000000" face="Georgia" size="-1">.</FONT></FONT><FONT size="+1" color="#000000"><U><FONT face=Tahoma 
size=-1 color="#000000"><BR>
  </FONT></U></FONT><FONT size="+1"><FONT face="Tahoma" size="-1"><BR>
    <BR>
     </FONT></FONT>
    <TABLE width="1261" cellspacing="1" cellpadding="1" height="56" style="height: 31px; left: 10px; top: 326px">
   <TBODY>
      <TR>
        <TD width="126"><FONT face="Arial" size="+0"><B>Kod Agensi</B></FONT></TD>
        <TD width="300" colspan="2">
        <INPUT size="3" tabindex="1" type="text" name="agcy_id"  maxlength="3" onFocus="nextfield='agcy_id1';">&nbsp;
        <INPUT size="5" tabindex="1" type="text" name="agcy_id1"  maxlength="5" onblur="jump(this)" onFocus="nextfield='user_id';">&nbsp;
        </TD>
      </TR>
      <TR>
        <TD width="126"></TD>
       <TD width="300" colspan="2"><INPUT size="95" tabindex="1" type="text" name="agcy_desc" maxlength="150" onblur="fc()" disabled></TD>
      </TR>
      <TR>
        <TD width="126"><FONT face="Arial" size="+0"><B>ID Pengguna</B></FONT></TD>
        <TD width="300" colspan="2"><INPUT size="20" type="text" name="user_id" tabindex="2" maxlength="8" onFocus="nextfield='new_pwd';"></TD>
      </TR>
      <TR>
        <TD width="126"><FONT face="Arial" size="+0"><B>Katalaluan</B></FONT></TD>
        <TD width="300" colspan="2">
        <INPUT size="20" type="password" name="new_pwd" tabindex="3" maxlength="8" onFocus="nextfield='SubmitLogin';">
        &nbsp;&nbsp;&nbsp;<script src="accept.asp"><INPUT size="1" type="hidden" name="acceptvalue" value="1"></script>
        </TD>
      </TR>
    </TBODY>

  <td width="126">

  <BR>

  <td width="300" colspan="2">

  <TR>
  <TD width="126">
    <p align="left"></TD>

  <TD width="145">
    <p align="right"><INPUT type="submit"  id="SubmitLogin" name="SubmitLogin" value="Login" tabindex="4"></TD>

我需要填写 5 个字段并调用登录按钮。1.agcy_id 2.agcy_id1 3.agcy_desc 4.user_id 5.new_pwd

如何使用 asp.net C# 自动登录?有人知道如何启动它吗?感谢您的回复。

4

1 回答 1

0

使用 Jquery发出POST请求 - ajax 传递您的表单数据参数,例如:

var formData = {agcy_id :"val",agcy_id1 :"val2",agcy_desc :"val3", agcy_desc:"val4"}; 

$.ajax({
    url : "YOUR_POST_URL",
    type: "POST",
    data : formData,
    success: function(data, textStatus, jqXHR)
    {
        //data - response from server
    },
    error: function (jqXHR, textStatus, errorThrown)
    {

    }
});

在这里,您有 AJAX 调用的实时示例,以及来自接收参数的服务器的答案:

Jquery AJAX POST 示例

执行 AJAX POST 后,您可以检索代码隐藏中的参数:

NameValueCollection nvc = Request.Form;
string agcy_id_var;
if (!string.IsNullOrEmpty(nvc["agcy_id "]))
{
  agcy_id_var= nvc["agcy_id "];
}
于 2013-10-22T07:23:45.807 回答