[Mono-list] Re quest object

Iggy MA iggy.ma at gmail.com
Thu Jun 26 14:40:44 EDT 2008


You are actually talking about 2 different things. Request.QueryString works
only in Asp.Net and refers to the Url Query String. If you had a url like
www.mysite.com?id=2, then id=2 would be the querystring, so you would do
System.Console.WriteLine( Request.QueryString["id"] ); and the output would
be 2. This will not work in a regular program because there is no url



http://iggyma.blogspot.com/




theallan wrote:
> 
> Hello all,
> 
> I'm afraid this is probably a total newbie question, but I can't seem to
> find an answer for it. I'm looking to write a C# program which can be used
> either on a CLI or as a web-based script. To this end I want to be able to
> use the 'Request.QueryString' array to retrieve GET data. So I do
> something like this:
> 
> public class Test
> {
> 	static void Main()
> 	{
> 		System.Console.WriteLine( Request.QueryString["hello"] );
> 	}
> }
> 
> But when I compile it I get:
> 
> $ gmcs test.cs 
> test.cs(6,43): error CS0103: The name `Request' does not exist in the
> current context
> Compilation failed: 1 error(s), 0 warnings
> 
> I don't understand what I am doing wrong. Does this work only in an
> ASP.NET environment, am I missing a 'using' statement? I can't seem to
> find any documentation for this. Any suggestions would be greatly
> appreciated!
> 
> Thanks
> Allan
> 

-- 
View this message in context: http://www.nabble.com/Request-object-tp18139827p18140555.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list