Simple XML Log

I want to receive an XML document via an aspx page and log the raw xml to a text file.  I've been looking at this for a while and can't work out how to do it.  Can someone tell me how to grab the raw xml text (once I've got the text I can do the logging bit)

Thanks
0
anonymous (74721)
5/10/2004 11:26:03 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
605 Views

Similar Articles

[PageSpeed] 4


HHoulston wrote:

> I want to receive an XML document via an aspx page and log the raw
> xml to a text file.  I've been looking at this for a while and can't
> work out how to do it.  Can someone tell me how to grab the raw xml
> text (once I've got the text I can do the logging bit)?

Assuming the XML document is sent as the body of an HTTP POST request 
the following should do:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
void SaveRequestBody (string fileName) {
   if (Request.HttpMethod == "POST") {
     BufferedStream bufferedInputStream = new 
BufferedStream(Request.InputStream);
     BufferedStream bufferedOutputStream = new BufferedStream(new 
FileStream(Server.MapPath(fileName), FileMode.Create));
     byte[] buffer = new byte[512];
     int byteCount;
     while ((byteCount = bufferedInputStream.Read(buffer, 0, 
buffer.Length)) != 0) {
       bufferedOutputStream.Write(buffer, 0, byteCount);
     }
     bufferedInputStream.Close();
     bufferedOutputStream.Close();
   }
}
void Page_Load () {
   string fileName = @"test20040510Log.xml";
   SaveRequestBody(fileName);
   Response.Write("<p>Saved request body as <a href=\"" + fileName + 
"\">file.</a></p>");
}
</script>

This however simply saves the bytes received as a byte stream, no XML 
well-formedness check is done so you might want to stream the bytes 
through an XmlReader before saving them
-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/

0
mahotrash (1778)
5/10/2004 12:30:14 PM
Reply:

Similar Artilces:

Event log error 9188
Every 15 minutes I'm getting one of these errors in my mailserver application event log. Now, before you get hasty and reply with the suggestion that the "Exchange Domain Servers" object is not in the "Users" container in AD, rest assured that it is where it's supposed to be and it contains the proper server. That's why this one has me bamboozled... More notes: mailserver is a member server running in native mode on a single native mode AD domain (we're a small outfit). Mailserver is Exch2K3 on Win2K3. DC is Win2K. Event Type: Error Event Source: MSExchang...

Unknown User found in OWA logs
Hi, I'm using SBS2003 (Premium with ISA) and I was looking through the ISA logs to see Outlook Web Access internet use and I saw an external unknown user name ("xxx") logging into our mail system and actually reading other peoples accounts. http://publishing.OurDomain.local:Port/exchange/xxx/ We don't have any user names called "xxx" how can I find out how this user is logging into the other accounts and reading mail ? Very worried...David Found out that you can login to your account by using any email address in your SMTP list and that name will show up in y...

Validating Xml with an with the longer form of EndElement fails
' First create Xml document Dim oXmlDocument As New System.Xml.XmlDocument oXmlDocument.LoadXml("<Trees><Oak TreeType=""deciduous""></Oak></Trees>") oXmlDocument.Save("Trees.xml") ' .NET save xml document with spaces <Trees> <Oak TreeType=""deciduous""> </Oak> </Trees> ' Because there is spaces between <Oak ...> and </Oak> validation against an xsd schema will now fail. Complains about white space. ' However, if the endelemnt </Oak> was removed...

DataSet to XML
I have data coming from SQL Server and need to write out some XML. I have a schema(xsd) for this XML file. Right now I am bringing in the DataSet and writing out the elements and attributes myself using xmltextwriter to match schema without really using the xsd at the time of writing. The file I create validates but I was wondering is there a better way? I see things like inferschema method off of dataset, can this be used? How do you map columns in a dataset with elements and attributes in the schema? I know dataset.WriteXmL will write XML but that match my schema. Appreciate any help! Tha...

Simple graph
I have a chart with zip codes and a population rate. ZIP RATE 80001 2.34 80002 1.23 80003 1.23 I want to make a chart that has the rate on the x axis and the number of times that rate occurs on the y axis. | | | * | | * |_________________________________ | | 1.23 2.34 Thank you. I will assume the ZIP and RATE stuff is in A1:B200 (labels in row 1) Label in G1 to read RATE (but leave it empty for now), label in H2 to read COUNT Make a list of rates in G2:G20 (say) In H2 =COUNTIF($B$2:$B$200,G2) Copy down the row Select H1:G20 and make a...

E2K Log files not flushing
I have three E2K servers that the transaction log files are not deleting after a full backup. We use Backupexec 9.1 but I have also tried using NTBACKUP, both unsucessful. These servers were recently patched with the Exchange Roll up - KB870540. I have two E2K servers that are clearing the log files but the do not have the roll up installed and are running BackupExec 8.6. Anyone any ideas? CJ. Have you made sure that a) you are backing up the entire Storage Group? and b) none of the mailbox stores are dismounted? Either of the above scenarios will cause the log files to not be purged. ...

Simple Simple Simple
Just started Excel (again) and need to make an easy speadsheet fo calculating square inches. Column A: Height Column B: Legnth Column C: Total Tags per 16 x 24 Column D: Cost per tag Figures I know: each sheet cost me $9.98. each sheet is 16 x 24 inches What I want to do is enter the Height, enter the Length and have th total (sum) be entered into columns C and D. I can't believe I forgot how to enter formulas. Any help will b appreciated. Thank you, Crai -- Message posted from http://www.ExcelForum.com Hi Craig, One Way, might be better ways but this'll work: List the colou...

Simple help with implementing Outlook-like GUI
Hi All. I am an experienced unix programmer who sometimes has to do something in the windows world, and always has newbie-questions. Basically I want to write an application program that looks like outlook in that it has nice icons down the left hand side that choose the content of the main area in the right hand side. So I started the MFC App wizard, and got me a SDI program with a CLeftFrame (CTreeView) and a CMainFrame (CFrameWnd). Then I prepared the following snippet of code to draw the buttons: // Create a pushbutton CBitmapButton* pmyButton; pmyButton = new CB...

Excel to XML conversion in Excel 2003
Does Excel 2003 have the ability to convert Excel spreadsheet into XML with custom DDT? I know that Excel 2003 can convert Excel data into XML, but I do not know if I can import my own DDT into Excel. thanks Hi Hao, > Does Excel 2003 have the ability to convert Excel > spreadsheet into XML with custom DDT? I know that Excel > 2003 can convert Excel data into XML, but I do not know if > I can import my own DDT into Excel. thanks Yes. You can attach a custom XML schema to a workbook and map each element in the schema to a separate cell or list in the workbook. Once y...

Simple hack to get $500 to your home. 06-05-10
Simple hack to get $500 to your home at http://uknews.tk Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

xml/rid question
I am using Visual Studio 2003/C# I created a new xml schema/xsd file (Project Create new item->Dataset) I then added Elements to the schema using the designer From the toolbox I then created an instance of my dataset. I then dropped a grid (Infragistics UltraWebGrid) onto my form, and bound the grid to my dataset. At runtime, I configure the columns of the grid, get some records from the Employee database (SQL Server2k), and add some rows to the grid. The user then enters some data into various cells of the grid. I am now ready to update the database with the contents of the grid. What ...

Simple Query Wizard hangs
I am using Access 2003 When I initiate the "Simple Query Wizard", I am presented with the first screen - "What fields do you want in your query" When I click on the pulldown list to select a table, I get the following message: "The expression On Get Focus you entered as the event property setting produced the following error: the text you entered isn't an item in the list * the expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]. * There may have been an error evaluating the function, event, or macro&q...

I Need a Simple Sales Software
Hello, I am looking for software to keep track of my prospects, customers, and the notes of the sales process. I spend about one hour a day on sales and marketing, so I prefer a simple and inexpensive software. Maximizer, Outlook, Act, and Goldmine seem made for the full-time professional salesperson. Please let me know if what I am looking for exists. Best Regards, T.I. ...

Make it more simple or intuitive to do simple things
I appreciate the fact that applications are becoming more versatile and able to do things that we hardly thought possible in the past but I feel that in this added complexity you are losing sight of the need to do simple things easily without resorting to trial and error or consulting "help" which often anyhow doesn't lead one straight to the solution! An example is how to produce a chart with a series of months i.e Jan Feb Mar etc appearing on the X axis. This is no doubt something that resulted naturally in the first versions of Excel charts or in a competitor's ea...

Urgent! What is wrong with this XML file
Hi, I have generated this XML from my application. But, when I open this XML, it is throwing error. Please help me to resolve this. <?xml version="1.0" encoding="utf-8" ?> <searchResults> <totalhits>16916</totalhits> <searchquery>*</searchquery> <timetaken>TIME TAKEN</timetaken> <resultsperpage>10</resultsperpage> <currentpage>CURRENT PAGE</currentpage> <totalpages>1692</totalpages> <content> <title>Web Title...</title> <reference>http://www7.hd...

Converting access tables to XML for use in .NET web app
I need to access tables in an .mdb file and convert them to XML for use in my ..NET 2.0 web application. Can anyone point me to any tutorials or references on how to accomplish this? (Note: I am using VB) Thanks! ...

Simple public folder permission problem
I have a public task list folder. However even though I have given everyone "Author" priviledges and full control of the directory, users cannot update the tasks (although they can create new ones). The changes to tasks get reset to their original values. Where should I look to fix this problem? Brian How did you grant Author Access, via Outlook or ESM? What do you meanyou gave them full control of the directory? "Brian Taylor" <taylorb@newsgroups.nospam> wrote in message news:e2hwumGrEHA.1160@tk2msftngp13.phx.gbl... > I have a public task list folder. Ho...

XML Serialisation problem
Hi, We are serializing objects to an xmlfile that is validated against a schema. For this schema the elements are serialized in the wrong sequence. Does anyone know how I can let the serializer sequence the object members in the order required by the schema? thx Patrick De block These threads might help: http://groups.google.com/groups?threadm=ucB6uaVcCHA.2532%40tkmsftngp09 http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=%234BfF5VzCHA.2232%40TK2MSFTNGP09 (Complete thread) "Patrick De Block" <patrick.de.block@pandora.be> wrote in messag...

What is simple text?
When creating a custom list that includes a column of accounting formated data, I get an error message that 'fields without simple text will be ignored'. The result is all other data except the accounting formatted data. Help!!!! I suppose it means without the currency symbol and thousands delimiters. On Fri, 8 Apr 2005 11:01:04 -0700, TexMas <TexMas@discussions.microsoft.com> wrote: >When creating a custom list that includes a column of accounting formated >data, I get an error message that 'fields without simple text will be >ignored'. The result is ...

simple question
Okay, I have a very simple question. Where do the old posts go after they run off the last page of this newsgroup? Sometimes I would like to refer to a post that I remember seeing in October, but is no longer on the current section. The search function seems to only search current posts as well. If anyone has some input please email me at joep@siboneylg.com Thanks kindly. have you tried google groups, they keep archived old posts: http://groups.google.co.uk/groups?q=microsoft.public.greatplains&hl=en "Joe Proehl" <joep@siboneylg.com> wrote in message news:099701c5...

Simple Macro is not so simple
Hi all, I am trying to record a macro which will automatically perform the insert > comment function to a selected cell. Should be easy right? Alas no Danny There's sample code on my web site, for inserting comments: http://www.contextures.com/xlcomments03.html Aardvark wrote: > Hi all, > > I am trying to record a macro which will automatically perform the insert > > comment function to a selected cell. Should be easy right? Alas no -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html Wow! Nice one :-) Thank you M...

(Error 1004) Object Defined Error ...simple code
I have the following simple simple code: Dim s as String s = WeekdayName(1) ' Causes Error 1004 Why would the above call to "WeekdayName(1)" suddenly cause an Object Defined Error?? My program has been working nicely for awhile, but now all of a sudden it halts at the above line??? What the heck is going on??? Robert Crandal Hi Robert, It works fine for me. However, checking out Help, the first day of week parameter is supposed to default to Sunday (or 1) as the first day of the week but it appears to default to zero. Tested in xl2002 and x...

vb--simple simple
hi, anyone know how to copy a combobox selection to a specific cell b using vb code in a command box -- Message posted from http://www.ExcelForum.com i cant see this in the userform. i know you can do this with a normal combo box which is not in a for but lost when in a userform -- Message posted from http://www.ExcelForum.com What's a "command box"? Can you give an clear example of what you want to do? -- Jim Rech Excel MVP "stevieh >" <<stevieh.16v8yw@excelforum-nospam.com> wrote in message news:stevieh.16v8yw@excelforum-nospam.com... | hi, | |...

How to receive and send XML using .NET
I would like to receive XML over the internet (via HTTP Post or SOAP), read it, perform some server side operations, and send back an XML response that would depend on the contents of the XML received. Seems simple, but I cannot find a good example of how to do this. In the Microsoft "Developing XML Web Services.." book, there is a nice discussion of XML and how to load it from a file and directly in code as a stream/string, but no mention of how to get or send it via HTTP. In an HTTP Post, how do I write my XML to the header and how do I read it? Also, is it necessary to use...

filtering xml
Hi I'm trying to filter an xml document that contains products for a CD store (music). My xml file is fine and displays fine, but I am a little confused about filtering it now. I want to give the user the option to choose a different genre of music (such as rock) and it will only display that particular genre. I have had a quick look into MSXML2, XPath and so on, but they are just confusing me more. Can anybody help me?? Broccie Broccie, When you say filter, do you mean that you want to select elements that meet certain criteria, for example they all have attributes that match a c...