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"]