POST будет работать если всё правильно передать.
Можно просто получить страничку, распарсить нужные параметры и передать постом.
1. Есть страничка, ваша упрощённая. В экшене АСП-скрипт:
PHP код:
<html>
<head>
</head>
<body id="login">
<!--<form id="fm1" class="fm-v clearfix" action="/cas/login?page=splashpage&target=top&service=/p/cas" method="post">-->
<form id="fm1" class="fm-v clearfix" action="http://test-srv/test/resp.asp" method="post">
<fieldset>
<ol>
<li>
<label for="username">User ID</label>
<input id="username" name="username" class="required" tabindex="1" accesskey="n" type="text" value="" autocomplete="on"/>
</li>
<li>
<label for="password">Password</label>
<input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" autocomplete="on"/>
</li>
<li class="last">
<button type="submit" name="submit" title="Login">Login</button>
<input type="hidden" name="lt" value="TEST-TEST-TEST" />
<input type="hidden" name="_eventId" value="submit" />
</li>
</ol>
</fieldset>
</form>
</body>
<html>
2. Получаем эту страничку и кликаем:
PHP код:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("http://test-srv/test/test.html");
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
webBrowser1.Document.GetElementById("username").InnerText = "t_login";
webBrowser1.Document.GetElementById("password").InnerText = "t_pass";
foreach (HtmlElement he in webBrowser1.Document.All)
{
if (he.GetAttribute("type") == "submit")
{
he.InvokeMember("click");
}
}
}
}
}
И как бы клик и переход есть.
АСП-скрипт такой:
PHP код:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Page</title>
</head>
<body>
<% response.write("username=" & Request("username") & " password=" & Request("password") & " lt=" & Request("lt"))%>
</body>
</html>