Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2011, 11:37 AM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Posting and Receiving XML Data in VB.NET

Can any one pls help and take a look at this code/ I'm trying to Post to a page and at the other end receive the xml Data but am getting '500 internal server error'

here is the code part for POSTing
Dim objRequest As HttpWebRequest = WebRequest.Create(TextBox2.Text)
Dim formData As String = "myField=" & System.Web.HttpUtility.UrlEncode(TextBox1.Text)
objRequest.ContentLength = formData.Length

'objRequest.ContentLength = TextBox1.Text.Length
objRequest.ContentType = "text/xml"
objRequest.Method = "POST"

Dim stmWriter As New System.IO.StreamWriter(objRequest.GetRequestStream ())
stmWriter.Write(formData)
stmWriter.Close()
Try
Dim objResponse As System.Net.HttpWebResponse = objRequest.GetResponse()
Dim stmReader As New System.IO.StreamReader(objResponse.GetResponseStre am())
Dim stringResult As String = stmReader.ReadToEnd()
stmReader.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try

this is the one receiving
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.Response.ContentType = "text/xml"
Dim xmlStream As New System.IO.StreamReader(Page.Request.InputStream)
Dim xmlData As String = xmlStream.ReadToEnd
....
processing codes for the data
...

Any comments or advice will be highly appreciated.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving data from parallel port using C#.net venkatvens Visual C++ 0 August 11th, 2008 05:44 AM
VB.net, adding XML data to an existing XML file saikoboarder XML 11 April 17th, 2008 04:19 PM
Problem Posting XML data via XMLHTTP steelrose XML 1 November 15th, 2007 05:19 PM
Finding , Locatin and Receiving data with XML. betzy XML 2 May 25th, 2004 07:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.