0

OpenLayers has a good example which I would like to reuse:

http://openlayers.org/dev/examples/dynamic-text-layer.html

This example is working fine in my pc. I would like to use my test.ashx handler instead of textfile.txt in above example

You can see i have replace the said example with my .ashx handler instead of textfile.txt in said example see below the code.

var osm = new OpenLayers.Layer.OSM();  
      // create a vector layer for drawing
    vector = new OpenLayers.Layer.Vector("Editable Vectors");
    var layer = new OpenLayers.Layer.Vector("POIs", {
                    strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1.1})],
                    protocol: new OpenLayers.Protocol.HTTP({
                        url: "test.ashx",
                        format: new OpenLayers.Format.Text()
                    })
                });



in test.ashx my code is simple. Which i have tested on url and working fine. It just printing same data which is available in "textfile.txt" in given example. see below.

point title description icon
25,67 my orange title my orange description

Code in test.ashx

public class Handler : IHttpHandler {

    public void ProcessRequest (HttpContext context) {

    context.Response.Write("point"+"\t"+"title"+"\t"+"description"+"\t"+"icon"+"\n"+
        "25,67"+"\t"+"my orange title"+"\t"+"my orange description");

    }

    public bool IsReusable {
    get {
        return false;
    }
    }
}

My goal is to design a handler which fetch data from database via .ashx. But before that i would like to ensure that this simple code will works.But it's not working. Any clue will be appreciated.

Gagravarr
  • 47,320
  • 10
  • 111
  • 156
papa
  • 9
  • 2

0 Answers0