0

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,

2 Answers 2

10

You can use Request.QueryString:

string userId = Request.QueryString["userid"];
string server = Request.QueryString["server"];
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.