我有2个链接如何一个参数添加到当前的URL在C#
<li class="active">
<a href="<%#CurrentSearchUrl%>"><span>Current search Page
</span></a>
<li><a href="<%#CurrentSearchUrlParam%>"><span>Add param </span>
</a>
在Page_Load
CurrentSearchUrl = Request.Url.AbsoluteUri;
CurrentSearchUrlParam = Request.Url+"&discount=1";
参数是添加,但网址是不正确的 我目前的网址是
http://localhost:1067/search/default.aspx?q=test
我想添加一个参数,所需的结果应该是
http://localhost:1067/search/default.aspx?q=test&discount=1
在此先感谢
您正在寻找[查询字符串](http://stackoverflow.com/questions/19987952/how-to-properly-use-a-querystring- in-net-asp-c) – Wahtever
CurrentSearchUrlParam和CurrentSearchUrlDiscount是不同的。你在页面上使用了正确的参数吗? –