QueryString

  • Thread starter Thread starter Mark Goldin
  • Start date Start date
M

Mark Goldin

How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?

Thanks
 
Mark said:
How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?

If you're using VB.NET then it's exactly the same.

If you're using C# then use brackets:

Request.QueryString["valuename"]
 
If I am trying to send that (Request.QueryString["valuename"]) to a function
then a function gets null as a value.
What am I doing wrong?

mikeb said:
Mark said:
How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?

If you're using VB.NET then it's exactly the same.

If you're using C# then use brackets:

Request.QueryString["valuename"]
 
Never mind. I figured it out.

Mark Goldin said:
If I am trying to send that (Request.QueryString["valuename"]) to a function
then a function gets null as a value.
What am I doing wrong?

mikeb said:
Mark said:
How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?

If you're using VB.NET then it's exactly the same.

If you're using C# then use brackets:

Request.QueryString["valuename"]
 
Mark said:
If I am trying to send that (Request.QueryString["valuename"]) to a function
then a function gets null as a value.
What am I doing wrong?

I don't know.

Sometimes a good way to figure out something like this is to create a
very simple project that just exercises the functionality you're having
problems with.

Save this to a file named "test.aspx" in a virtual directory:

=====================================================
<%@ Page Language="c#" trace="true"%>
<HTML>
<HEAD>
<script language="C#" runat="server">
private void Page_Load( object sender, System.EventArgs e)
{
Response.Write( "Hello, ");
string name = Request.QueryString["name"];
if (name != null) {
Response.Write( name);
}
else {
Response.Write( "whoever you are");
}
Response.Write("<br/>");
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
</form>
</body>
</HTML>
=====================================================

Now, hit that page with a browser (something like
"http://localhost/virtdir/test.aspx").

You should see "Hello, whoever you are" since no query parameter was
provided.

Now append "?name=mike" to the URL, and you'll see "Hello, mike"

The trace="true" directive at the top of the aspx file will cause a
bunch of diagnostic info to display at the bottom of the page. This
includes a "QueryString collection" section that will probably be very
helpful to debugging your real page's problem if you add the directive
to your aspx file.

Mark said:
How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?

If you're using VB.NET then it's exactly the same.

If you're using C# then use brackets:

Request.QueryString["valuename"]
 
I have exactly the same problem, can you post the solution?

Thanks!
rWyatt

Mark Goldin said:
Never mind. I figured it out.

Mark Goldin said:
If I am trying to send that (Request.QueryString["valuename"]) to a function
then a function gets null as a value.
What am I doing wrong?

mikeb said:
Mark Goldin wrote:
How can I pull data on the server from QueryString?
In classic ASP I do Request.QueryString("valuename").
What about doing something like this in ASP.NET?


If you're using VB.NET then it's exactly the same.

If you're using C# then use brackets:

Request.QueryString["valuename"]
 
Back
Top