Write XML to the output stream from an ASP.NET web site

Posted on 2006-06-22
Last Modified: 2008-02-01
I have an ASP.NET web site using VB.NET and I would like to dump XML to the output stream.  For example,

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    dim dataset1 as New Data.DataSet=getbudgets()
    response.Write(dataset1 as xml)           'this is the part that doesn't work
End Sub

I have to think this can be done since an ASP.NET XML web service consists of functions like

<WebMethod()> _
    Public Function getSystemLog(ByVal FromDate As Date, ByVal ToDate As Date) As SystemLogEntryType()
        Dim retval(1) As SystemLogEntryType

and they spit out XML
Question by:stev0931
  • 3
  • 3
LVL 26

Accepted Solution

Rejojohny earned 500 total points
ID: 16965180
response.Write(dataset1.getxml()) should work ..


Author Comment

ID: 16966021
Great!  By any chance, do you know how to do this for an arbitrary object type?
LVL 26

Expert Comment

ID: 16970561
what is an arbitrary object type??
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Author Comment

ID: 16970876
For example,

class DataType

public ID as long
public Name as string
public Description as string

end class
LVL 26

Assisted Solution

Rejojohny earned 500 total points
ID: 16971205
i do not think there is any generic way of converting a class to xml ..

Author Comment

ID: 17024242
Thanks!  I've got a solution working now...

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question