Reputation: 1
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 executing the URL in IE.
anyone ideas?
(not sure if the title is right)
thanks in advance
Upvotes: 0
Views: 384
Reputation: 5423
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);
Upvotes: 1
Reputation: 1447
Build the url in code:
string url = "&aqi=g10&aql=\"" + comboBox1.Text + "\"&oq=\"" + comboBox2.Text + \"";
Upvotes: 0