Network Analyst routing
ArcGIS_Routing_VBNet\GenerateImage.aspx.vb
' Copyright 2010 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 




Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports ESRI.ArcGIS.ADF.Web
Imports System.Drawing
Imports System.IO

Partial Public Class GenerateImage
  Inherits System.Web.UI.Page
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim md As MimeData = CType(Session("mymimedata"), MimeData)
    Dim mi As ESRI.ArcGIS.ADF.Web.MapImage = New ESRI.ArcGIS.ADF.Web.MapImage(md)
    Dim bmp As Bitmap = mi.GetImage()

    Response.ContentType = "image/png"
    Using stream As MemoryStream = New MemoryStream()
      bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
      stream.WriteTo(Response.OutputStream)
    End Using
    bmp.Dispose()
  End Sub
End Class