if (!(args.Control is ESRI.ArcGIS.Server.WebControls.Map))
return;
ESRI.ArcGIS.Server.WebControls.Map map = args.Control as ESRI.ArcGIS.Server.WebControls.Map;
using (WebMap webMap = map.CreateWebMap())
{
IServerContext ctx = webMap.ServerContext;
Polyline line= ctx.CreateObject("esriGeometry.Polyline") as Polyline;
PolylineEventArgs polyLine = args as PolylineEventArgs;
// Get a reference to the Web Page that contains the Map Control
System.Web.UI.Page page = polyLine.Control.Page;
string coords;
coords = polyLine.ToString();
webMap.ManageLifetime(line);
IPoint pt = ctx.CreateObject("esriGeometry.Point") as IPoint;
webMap.ManageLifetime(pt);