我在asp.net 2.0 的Web 应用程序中制作了一个用于身份验证的Http 模块。当 AuthticateRequest 事件被触发时,我会从当前请求中获取用户 ID 和密码值。但每次我都变得空虚。我的代码在这里
namespace Business.YouBecome
{
class LoginModuleYouBecome : IHttpModule
{
public void Init(HttpApplication httpApplication)
{
httpApplication.AuthenticateRequest += new EventHandler(httpApplication_AuthenticateRequest);
// httpApplication.AuthorizeRequest += new EventHandler(httpApplication_AuthorizeRequest);
}
void httpApplication_AuthenticateRequest(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = (HttpContext)application.Context;
clsLogin login = new clsLogin();
login.UserName = application.Request["txtuser"];
login.Password = application.Request["txtpass"];
//throw new NotImplementedException();
}
public void Dispose() { }
}
}
我在类库项目中有这个类,并在 web.config 中添加了代码。
请建议我在哪里做错了。提前致谢。