Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Query string and code behind


Message #1 by "Shay E. Phillips" <sphillips@m...> on Fri, 24 May 2002 18:39:10
When I try to use HttpRequest.Params["myParam"] in a code-behind.cs file 
I get an error (An object reference is required for the nonstatic field, 
method, or property 'System.Web.HttpRequest.Params'). But if I paste the 
same code inline in my aspx page I don't get the error. Any idea why this 
is?
Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Tue, 28 May 2002 08:40:43 -0400
Shay,

	Try adding this to your codebehind file:

using System.Web;

// in your code, where ever:
HttpRequest req = HttpContext.Current.Request;
Page.Trace.Write req.Params["yourParam"];

	See if that does anything for you.

HTH,
- Chuck

-----Original Message-----
From: Shay E. Phillips [mailto:sphillips@m...]
Sent: Friday, May 24, 2002 2:39 PM
To: ASP+
Subject: [aspx] Query string and code behind


When I try to use HttpRequest.Params["myParam"] in a code-behind.cs file 
I get an error (An object reference is required for the nonstatic field, 
method, or property 'System.Web.HttpRequest.Params'). But if I paste the 
same code inline in my aspx page I don't get the error. Any idea why this 
is?

  Return to Index