0
我正在为我的web应用程序在asp.net 2.0中进行身份验证的Http模块。当AuthticateRequest事件被触发时,我得到当前请求的用户标识和密码值。但是,每次我都在两个空。我的代码在这里如何在asp.net 2.0中的HTTP模块中获取登录文本框的值?
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中添加了代码。
请建议我在哪里做错了。提前致谢。
感谢您的这一点,但我想在这里验证用户,所以我想登录信息在这里不可用。每当我得到空。我从这里得到了参考。 http://www.15seconds.com/issue/020417.htm – Deepak 2011-03-04 04:55:57
@Deepak对不起,我误解了这个问题。我以为你想在常规表单身份验证之后添加更多逻辑。 – 2011-03-04 07:56:34