0

我有这样的要求:

http://Server/wms/servlet/WMSServer?userid=hidden&passwd=hidden&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-93.0562371212999,44.2252121686514,-92.7059804612417,44.3405684382141&WIDTH=1840&HEIGHT=606&LAYERS=VIEWS&STYLES=&EXCEPTIONS=application/vnd.ogc.se_xml&FORMAT=image/png&BGCOLOR=0xFEFFFF&TRANSPARENT=TRUE

请求通过代理页面传递,是否可以更改代理页面中的请求,以便我可以向“样式”参数添加一个值,如下所示:

http://Server/wms/servlet/WMSServer?userid=hidden&passwd=hidden&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-93.0562371212999,44.2252121686514,-92.7059804612417,44.3405684382141&WIDTH=1840&HEIGHT=606&LAYERS=VIEWS&STYLES=**TIMESTAMP**&EXCEPTIONS=application/vnd.ogc.se_xml&FORMAT=image/png&BGCOLOR=0xFEFFFF&TRANSPARENT=TRUE

基本上改变 - &STYLES=&EXCEPTIONS=.... 到 &STYLES=TIMESTAMP&EXCEPTIONS=....

4

1 回答 1

0

想通了,一点都不难。

只需设置代理来处理请求并在 URI 字符串上执行一些简单的逻辑。

 public void ProcessRequest(HttpContext context)
{   
    HttpResponse response = context.Response;

    // Get the URL requested by the client (take the entire querystring at once
    //  to handle the case of the URL itself containing querystring parameters)
    string uri = Uri.UnescapeDataString(context.Request.QueryString.ToString());


    // Get token, if applicable, and append to the request
    string token = getTokenFromConfigFile(uri);


    // Add the 'TIMESTAMP' Value  to the Valtus Service
    string styleparam = "&STYLES=";
    if (uri.Contains(styleparam))
    {
        int position = uri.IndexOf(styleparam) + styleparam.Length;
        uri = uri.Insert(position, "TIMESTAMP");
    }

    System.Net.WebRequest req = System.Net.WebRequest.Create(new Uri(uri));

}

于 2012-08-14T21:48:15.643 回答