tags:

views:

105

answers:

2

I want to handle links like this:

http://example.com/test.aspx?userid=tras&server=bum

I looked here, and they do this:

HttpApplication objApp = (HttpApplication) sender;  <--- ERROR LINE
string userid = objApp.Request["userid"].ToString();

But I get the error:

Unable to cast object of type 'ASP.test_aspx' to type 'System.Web.HttpApplication'.

I need simple input from html nothing fancy. Just to get couple of string items in way described above,

+10  A: 

You can use Request.QueryString:

string userId = Request.QueryString["userid"];
string server = Request.QueryString["server"];
Chris Pebble
awesome thanks man!!!
grobartn
+1  A: 

What they are doing in the article you link to is implement an http handler. What you need to do is implement an aspx page if you simply want to handle user input.

Ronald Wildenberg