I'm not sure if you are asking for help with a mojo site or another site, in mojo you have a direct address where and ashx handler make that for you, you can read the documentation here http://www.mojoportal.com/submitting-your-site-maps-to-google-and-bing.aspx.
If you want to implement this for another site you can look into the code in the mojoportal\Web\SiteMap.ashx.cs