Hi
I need to design a form that I can programmatically post using this code
from a VB .NET Windows Application:
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes("data=MYDATA")
Dim res As Byte() = web.UploadData("strHttpLocation & "sync.aspx", "POST",
d)
Console.Write(System.Text.Encoding.ASCII.GetString (res))
My current form design is like this, the data being posed by an the
asp:button id="post". What changes do I need to make to enable this post
method?
Thanks
B
<HTML>
<HEAD>
<title>sync</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtCmd" style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 120px" runat="server" Width="385px">
</asp:textbox>
<asp:textbox id="txtData" style="Z-INDEX: 102; LEFT: 56px; POSITION:
absolute; TOP: 176px" runat="server" Width="384px" Height="288px"
TextMode="MultiLine">
</asp:textbox>
<asp:button id="post" style="Z-INDEX: 103; LEFT: 384px; POSITION: absolute;
TOP: 488px" runat="server" Text="Button" CommandName="POST">
</asp:button>
</form>
</body>
</HTML>
ON CLICK
Private Sub post_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles post.Click
End sub