Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Post xml to Asp.net page

3 views
Skip to first unread message

quest

unread,
May 27, 2005, 5:11:50 AM5/27/05
to
My windows application (console application) posts xml (HTTP "POST") to
Asp.net page. My question is:

1. How should I code my Asp.net page so that it is able to 'detect' that
something is posted to it ?

2. How do I extract the xml from the html page ?

Thanks.


Mona

unread,
May 27, 2005, 9:13:20 AM5/27/05
to
Hi,
 
I'm answering your both queries here:

For the first question:, you can use the Request.Form to detect whatever has been posted

to the ASP.NET page as follows:

 Request.Form("fieldname")

Now for the second question, since Xml is being posted to the page, Do a request.form() of the fieldname
that contains the XML, store it into a string. Then use XMLDOcument to save it to an XML file or use XMLWRiter
 
HTH
 
Mona[Grapecity]
 
 

Bruce Barker

unread,
May 27, 2005, 12:05:17 PM5/27/05
to
depends on how the console app is posting. if its a form post, then use
Request["fieldName"], if the body is just xml, use Request.InputStream, if
its a soap call, use the web service interface. it could also be a file
upload, or attachment. you will also need to know of any encofding schemes
used.

-- bruce (sqlwork.com)

"quest" <annon...@microsoft.com> wrote in message
news:%2330Pdxp...@TK2MSFTNGP12.phx.gbl...

quest

unread,
May 28, 2005, 12:31:20 AM5/28/05
to
Thanks for the information. I created a simple Asp.net application. Request.Form will work but exactly when I should do "Request.Form" ? Is there any event driven stuffs to deal with when a POST is detected ? Thanks in advance.
 
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
 
namespace MyWeb
{
 public class WebForm1 : System.Web.UI.Page
 {
  private void Page_Load(object sender, System.EventArgs e)
  {
   // Put user code to initialize the page here
  }
 
  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {   
   this.Load += new System.EventHandler(this.Page_Load);
  }
  #endregion
 }
}
 
 
0 new messages