C#问题:Request is not available in this context?函数里不能用Request对象?
要求语言:C#
出错行提示:
System.Web.HttpException: Request is not available in this context
源代码:
//一个Page继承下来的类的一个成员函数
......
protected int GetPage()
{
string strTemp = Request.QueryString[ strPageVariable ].ToString(); //出错行
int nCurPage = 1;
//if ( 1 == UserDefineFunction.IsNumeric( strTemp );
nCurPage = Convert.ToInt16( strTemp );
if ( nCurPage > nPageCount || nCurPage < 1 )
nCurPage = 1;
return nCurPage;
}
....
----------