Google Answers Logo
View Question
 
Q: sending text/XML in C# ( No Answer,   3 Comments )
Question  
Subject: sending text/XML in C#
Category: Computers > Internet
Asked by: nk412-ga
List Price: $50.00
Posted: 28 Dec 2003 14:09 PST
Expires: 27 Jan 2004 14:09 PST
Question ID: 290921
How do I send XML request in C# ?

Request for Question Clarification by answerguru-ga on 28 Dec 2003 16:45 PST
Hi there,

Could you please be a bit more specific as to what you are attempting
to achieve? Are you connecting to a specific source? If so please
provide the appropriate details.

Also, are you looking for sample code or more of a tutorial that will
show how to do this?

answerguru-ga

Clarification of Question by nk412-ga on 28 Dec 2003 18:23 PST
Hi answerguru-ga,
I want to send aspx page1 that sends data in XML format such as
<UserId>User1</UserId> to another aspx page2 (in the format text/xml).
I want a sample that I can use to both send and receive data.

I know that using classic asp (not .net) we could use MSXML but that
does not seem to be possible here.

A working sample would be great.
Thanks
Krishnan

Clarification of Question by nk412-ga on 31 Dec 2003 17:53 PST
Not Web services 

No I am not using web services, I want to send and receive informaiton
in pure XML format (not using a file either). What works in classic
XML does not work here.

Thanks

Request for Question Clarification by mathtalk-ga on 03 Jan 2004 17:01 PST
Hi, nk412-ga:

I think you are asking how to request XML data using an HTTP REQUEST
in ASPX, using C# as needed to process the returned information.

Of course you might be equally interested in how to respond, at the
other end of the "connection" to such a request.

Is this the gist of your question?

regards, mathtalk-ga
Answer  
There is no answer at this time.

Comments  
Subject: Re: sending text/XML in C#
From: cdc-ga on 31 Dec 2003 07:52 PST
 
Are you using web services?  Are these pages in the same web or
different?  Can you utilize web services, or do you need to send the
data during a redirect?
Subject: Re: sending text/XML in C#
From: nk412-ga on 31 Dec 2003 17:54 PST
 
Not using web services, just transfer using XML Request/response
Subject: Re: sending text/XML in C#
From: cdc-ga on 03 Jan 2004 14:47 PST
 
Well, to generate some XML, use the System.Xml namespace. E.G.:

using System.Xml;

[...]

public string GetUserXml(string userName)
{
    XmlDocument doc=new XmlDocument();
    XmlElement userId=doc.CreateElement("UserId");
    userId.InnerText=userName;
    doc.AppendChild(userId);
    return doc.OuterXml;
}

The call GetUserXml("User1") will generate and return the XML string
"<UserId>User1</UserId>". Just modify the method as you see fit, and
use a WebRequest to send the data out...

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy