0

I have a request like this :

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

the request is passed through a proxy page, is it possible to alter the request in the proxy page so that i can add a value to the 'Styles' parameter like this:

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

Basically changing - &STYLES=&EXCEPTIONS=.... to &STYLES=TIMESTAMP&EXCEPTIONS=....

NotARobot
  • 978
  • 2
  • 14
  • 36

1 Answers1

0

Figured it out, wasnt that hard at all.

just set the proxy to process the request and did some simple logic on the URI String.

 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));

}

NotARobot
  • 978
  • 2
  • 14
  • 36