Anonymous     VB.net     09 Sep 2008    
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Public Class RemotePost
Private Inputs As System.Collections.Specialized.NameValueCollection = New System.Collections.Specialized.NameValueCollection
Public Url As String = ""
Public Method As String = "post"
Public FormName As String = "form1"
Public Sub Add(ByVal name As String, ByVal value As String)
Inputs.Add(name, value)
End Sub
Public Sub Post()
System.Web.HttpContext.Current.Response.Clear()
System.Web.HttpContext.Current.Response.Write("<html><head>")
System.Web.HttpContext.Current.Response.Write(String.Format("</head><body onload=""document.{0}.submit()"">", FormName))
System.Web.HttpContext.Current.Response.Write(String.Format("<form name=""{0}"" method=""{1}"" action=""{2}"" >", FormName, Method, Url))
Dim i As Integer = 0
Do While i < Inputs.Keys.Count
System.Web.HttpContext.Current.Response.Write(String.Format("<input name=""{0}"" type=""hidden"" value=""{1}"">", Inputs.Keys(i), Inputs(Inputs.Keys(i))))
i += 1
Loop
System.Web.HttpContext.Current.Response.Write("</form>")
System.Web.HttpContext.Current.Response.Write("</body></html>")
System.Web.HttpContext.Current.Response.End()
End Sub
End Class