I have 2 links
<li class="active">
<a href="<%#CurrentSearchUrl%>"><span>Current search Page
</span></a>
<li><a href="<%#CurrentSearchUrlParam%>"><span>Add param </span>
</a>
in the Page_Load
CurrentSearchUrl = Request.Url.AbsoluteUri;
CurrentSearchUrlParam = Request.Url+"&discount=1";
param is added but url is not correct my current url is
http://localhost:1067/search/default.aspx?q=test
I want to add one parameter, the desired result should be
http://localhost:1067/search/default.aspx?q=test&discount=1
Thanks in advance
var uriBuilder = new UriBuilder(Request.Url.AbsoluteUri);
var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
paramValues.Add("param1", "value1");
paramValues.Add("param2", "value2");
uriBuilder.Query = paramValues.ToString();
Link1.HRef=uriBuilder.Uri;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With