c# - Change the Query String Content edit or split from web config file (QUERY_STRING server variable) -
i have problem regarding isapi rule in web.config file. want change content of query string. means want split query string can remove undesired data before writing url.
<rule name="something"> <matchurl=".?" /> <condition logicalgrouping="matchall"> <add input="{query_string}" pattern={something2} /> </condition> <action type="redirect" url="http://{http_host}{url}querystring"appendquerystring="true" redirecttype="found" />
now want remove part of querystring. how can that? know how split or edit contents of querystring?
use uribuilder
, httputility
this. first drop url uribuilder
:
var uri = new uribuilder(url); uri.port = -1;
now work query string:
var query = httputility.parsequerystring(uri.query);
then remove ones don't want:
query.remove("parmname");
and put together:
uri.query = query.tostring(); var newurl = uri.tostring();
Comments
Post a Comment