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??
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

861 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