Hi,
I am having the same issue and I am not able to figute out why. This is my code? Any thoughts?
using
System;
using
System.Drawing;
using
System.IO;
using
System.Web;
using
BREWServer.MapPointService;
using
System.Collections.Specialized;
using
System.Web.UI.HtmlControls;
namespace
BREWServer
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
RenderServiceSoap renderService =
new RenderServiceSoap();
renderService.PreAuthenticate =
true;
renderService.Credentials =
new System.Net.NetworkCredential("******","***********");
ViewByScale[] myViews =
new ViewByScale[1];
myViews[0] =
new ViewByScale();
myViews[0].CenterPoint =
new LatLong();
NameValueCollection coll=Request.QueryString;
String latlon = coll.GetValues("latlon")[0];
int sep = latlon.LastIndexOf("^");
String lat = latlon.Substring(0, sep);
String lon = latlon.Substring(sep + 1, latlon.Length - (sep + 1));
myViews[0].CenterPoint.Latitude = Double.Parse(lat) / 3106;
myViews[0].CenterPoint.Longitude = Double.Parse(lon) / -3106;
myViews[0].MapScale = 100000;
MapSpecification mapSpec =
new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
MapImage[] mapImages;
mapImages = renderService.GetMap(mapSpec);
Context.Response.Clear();
Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Context.Response.ContentType = mapImages[0].MimeData.MimeType;
MemoryStream ms =
new MemoryStream(mapImages[0].MimeData.Bits);
Image i = Image.FromStream(ms);
i.Save("c:\\brew\\btmp.png", System.Drawing.Imaging.ImageFormat.Png);
FileStream fs =
new FileStream("c:\\brew\\btmp.png", FileMode.Open);
byte[] b = new byte[fs.Length];
fs.Read(b, 0, b.Length);
Context.Response.BinaryWrite(b);
fs.Close();
File.Delete("c:\\brew\\btmp.png");
Context.Response.End();
}
#region
Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}