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

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
stev0931Asked:
Who is Participating?
 
RejojohnyConnect With a Mentor Commented:
response.Write(dataset1.getxml()) should work ..

Rejo
0
 
stev0931Author Commented:
Great!  By any chance, do you know how to do this for an arbitrary object type?
0
 
RejojohnyCommented:
what is an arbitrary object type??
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
stev0931Author Commented:
For example,

class DataType

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

end class
0
 
RejojohnyConnect With a Mentor Commented:
i do not think there is any generic way of converting a class to xml ..
0
 
stev0931Author Commented:
Thanks!  I've got a solution working now...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.