Openlayer WFSレイヤー及びC#作成ASPをロードする.Netエージェントはドメインをまたぐ問題を解決して、とても長い問題


NND,openlayersドメインをまたいでgeoserverにアクセスするにはエージェントが必要なのですが、Felxは使わないようです.C#でエージェントを書くネット上では一般的にそうです.
    public class GeoServerProxy1 : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.QueryString["URL"] != null)
            {
                string url = "";
                url = context.Request.QueryString["URL"].ToString();
                HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(url);
                loHttp.Timeout = 10000;     // 10 secs
                loHttp.UserAgent = "Web Client";
                HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
                Encoding enc = Encoding.GetEncoding(65001);
                StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
                string lcHtml = loResponseStream.ReadToEnd();
                context.Response.Write(lcHtml);
                loWebResponse.Close();
                loResponseStream.Close();
            }
        }

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

しかし、上記の場合、postは考慮されず、openlayers公式のwfsプロトコルアクセスには適用されませんが、httpクエリー方式のアクセスに使用できます.たとえば、次のようにします.
vectorLayer = new OpenLayers.Layer.Vector("   ", {
                    protocol: new OpenLayers.Protocol.HTTP({
                        //url: "http://10.180.80.206:9000/geoserver/sdgis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sdgis:V_YL_24&maxFeatures=50",
                        //url: "http://10.180.80.206:9000/geoserver/sdgis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sdgis:GIS_WEATHER_FORECAST&maxFeatures=50",
                        url: "http://10.180.80.206:9000/geoserver/sdgis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sdgis:V_FBJC_PT&maxFeatures=50",
                        format: new OpenLayers.Format.GML()
                    }),
                    styleMap: new OpenLayers.StyleMap({
                        'default': {
                            strokeColor: "#00FF00",
                            strokeOpacity: 1,
                            strokeWidth: 2,
                            fillColor: "#FF0000",
                            fillOpacity: 1,
                            pointRadius: 6,
                            strokeDashstyle: 'longdashdot',
                            pointerEvents: "visiblePainted",
                            externalGraphic: "snow.gif",
                            graphicWidth: 12,
                            graphicHeight: 12,
                            //label: "name: ${OWNER}, age: ${FLAGS}",

                            fontColor: "${favColor}",
                            fontSize: "12px",
                            fontFamily: "Courier New, monospace",
                            fontWeight: "bold",
                            labelAlign: "${align}",
                            labelXOffset: "${xOffset}",
                            labelYOffset: "${yOffset}"
                        }
                    }),
                    renderers: renderer,
                    strategies: [new OpenLayers.Strategy.Fixed()]
                });

まずopenlayersの公式wfsプロトコルがどのようにアクセスされているかを見てみましょう.
var fbjcLayer = new OpenLayers.Layer.Vector("FBJC_PT", {
                strategies: [new OpenLayers.Strategy.BBOX()],
                protocol: new OpenLayers.Protocol.WFS({
					 version: "1.1.0",
                    url: "http://10.180.80.206:9000/geoserver/wfs",
                    featureType: "sdgis:V_FBJC_PT",
                    featureNS: "sdgid"
                }),
                renderers: OpenLayers.Layer.Vector.prototype.renderers
            });

これはpostリクエストです.エージェントを変更してサポートします.ネット上に流布しているエージェントがparameter missing異常を報告する場合は、以下は改善されたC#エージェントです.
public class GeoServerProxy1 : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            if (string.IsNullOrEmpty(context.Request["URL"])) return;
            HttpWebRequest request = (HttpWebRequest) WebRequest.Create(context.Request["URL"]);
            request.UserAgent = context.Request.UserAgent;
            request.ContentType = context.Request.ContentType;
            request.Method = context.Request.HttpMethod;

            byte[] trans = new byte[1024];
            int offset = 0;
            int offcnt = 0;

            if (request.Method.ToUpper() == "POST")
            {
                Stream nstream = request.GetRequestStream();
                while (offset < context.Request.ContentLength)
                {
                    offcnt = context.Request.InputStream.Read(trans, offset, 1024);
                    if (offcnt > 0)
                    {
                        nstream.Write(trans, 0, offcnt);
                        offset += offcnt;
                    }
                }
                nstream.Close();
            }
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            //Encoding enc = Encoding.GetEncoding(65001);
            context.Response.ContentType = response.ContentType;
            StreamReader loResponseStream = new StreamReader(response.GetResponseStream());
            string lcHtml = loResponseStream.ReadToEnd();
            context.Response.Write(lcHtml);
            response.Close();
            loResponseStream.Close();

        }

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