我有这样的请求:
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 = .... to& STYLES = TIMESTAMP& EXCEPTIONS = ....
答案 0 :(得分: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));
}