I am calling an .aspx script through AJAX. In that script I am attempting to get a value from the query string using Request.QueryString["i"] but it always returns null even though, if I examine the Request object in debug mode, the query string IS right there.
Whats going wrong & how can I retrieve the i parameter value from testScript.aspx?i=199?
Heres my simple code:
public partial class getData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
short index = System.Convert.ToInt16(Request.QueryString["i"]); // BREAKPOINT
}
}
When I use a break point & examine the Request Object I can see that the Request.QueryString variable is empty(just a {}). Request.QueryString["i"] is null.
If you look at the following img you can see the form has my i parameter(thats my query string .aspx?i=4

Your form is sent using POST request, and parameter i is not in QueryString but in request body encoded using multipart form data format,
Request.QueryStringonly show’s parameters passed through URI like page.asax?i=4. UseRequest.Form["i"]