Try this on for size :
Private Sub OnPostInfoClick(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strId As String = UserId_TextBox.Text
Dim strName As String = Name_TextBox.Text
Dim encoding As ASCIIEncoding = New ASCIIEncoding
Dim postData As String = "userid=" + strId
postData += ("&username=" + strName)
Dim data As Byte() = encoding.GetBytes(postData)
Dim myRequest As HttpWebRequest = CType(WebRequest.Create("http://localhost/MyIdentity/Default.aspx"), HttpWebRequest)
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = data.Length
Dim newStream As Stream = myRequest.GetRequestStream
newStream.Write(data, 0, data.Length)
newStream.Close
End Sub
Translation to VB.NET courtesy of
http://www.developerfusion.com/utili...sharptovb.aspx
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"mplutodh1" <mp*******@gmail.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
I am not up with all the C# as I usually use VB, could someone explain
to me how I would accomplish this in VB? Thanks!
http://www.netomatix.com/HttpPostData.aspx
private void OnPostInfoClick(object sender, System.EventArgs e)
{
string strId = UserId_TextBox.Text;
string strName = Name_TextBox.Text;
ASCIIEncoding encoding=new ASCIIEncoding();
string postData="userid="+strId;
postData += ("&username="+strName);
byte[] data = encoding.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://localhost/MyIdentity/Default.aspx");
myRequest.Method = "POST";
myRequest.ContentType="application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream=myRequest.GetRequestStream();
// Send the data.
newStream.Write(data,0,data.Length);
newStream.Close();
}