A user is sending me a data value in a web browser -see below for example. I would like to get this value and use it downstream. I try using string val = Request.QueryString[X_ACCOUNTID] but it did not work. Any idea on how I can retrieve the value in my ASP code behind?

http://SERVERNAME/TEST/MYTEST.aspx?X_ACCOUNTID=123

A user is sending me a data value in a web browser -see below for example. I would like to get this value and use it downstream. I try using string val = Request.QueryString[X_ACCOUNTID] but it did not work. Any idea on how I can retrieve the value in my ASP code behind?

http://SERVERNAME/TEST/MYTEST.aspx?X_ACCOUNTID=123

Here is the Solution:

string val;
if(Request.QueryString.Count>0)
{
  val= Request.QueryString["X_ACCOUNTID"];
}

Here is the Solution:

string val;
if(Request.QueryString.Count>0)
{
  val= Request.QueryString["X_ACCOUNTID"];
}

Although I can see the X_ACCOUNTID value in the url, it is empty when I try to access it. In fact the entire url is missing when in debug mode in Page_Load. Any idea why the url is missing although I can see it in the address bar?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.