Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request from a cs class

Status
Not open for further replies.

fid

Programmer
May 10, 2001
20
US
is there a way to access the request.form values from a class?

for example:
<%@ Page language=&quot;C#&quot; debug=&quot;true&quot; src=&quot;../bin/MyCode.cs&quot; %>
<%@ Import namespace=&quot;MyNamespace&quot; %>
<script language=&quot;C#&quot; runat=&quot;server&quot;>
void Page_Load() {
MyTest _m = new MyTest();
string _x = _m.TestRequest();
Response.Write(_x);
}
</script>


MyCode.cs:
namespace MyNamespace {

using System;
using System.Web;
using System.Web.UI;

public class MyTest : System.Web.UI.Page {
public string TestX() {
string _x = Request.QueryString[&quot;mytest&quot;];
return _x;
}
}
} // end namespace

no matter what syntax i try i end up with something like
System.Web.HttpException: Request is not available in this context

thanks for help
Fid
 
have you tried Request.Forms[&quot;mytest&quot;]; ???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top