"Dynamic" parts in URL
The application i'm making starts Internet Explorer with a specific URL. for instance, this fake url:
&aqi=g10&aql="3"&oq="3"
how can i change that url into this one:
&aqi=g10&aql="2"&oq="2"
by using an item from a combobox?
What i'm trying to do is changing a part of the URL with selecting an item in a combobox and then 开发者_如何学Goexecuting the URL in IE.
anyone ideas?
(not sure if the title is right)
thanks in advance
If I understood correctly what you're trying to do, you can get the query string parameters with Request.QueryString, do the manipulations as per the selections in the combobox, then build the new URL and redirect to it with Response.Redirect.
http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx
http://msdn.microsoft.com/en-us/library/t9dwyts4.aspx
Something like:
// get the URL from the Request and remove the query string part
string newUrl = Request.Url.ToString().Replace(Request.Url.Query, "");
newUrl += string.Format("?aqi={0}&aql={1}&oq={2}",
Request.QueryString["aqi"], ddlAql.SelectedValue, ddlOq.SelectedValue);
Response.Redirect(newUrl);
Build the url in code:
string url = "&aqi=g10&aql=\"" + comboBox1.Text + "\"&oq=\"" + comboBox2.Text + \"";
加载中,请稍侯......
精彩评论