1
가능한 중복 :
.NET Application_BeginRequest - How to get User reference?asp.net 로그인 컨트롤과 Global.asax에있는 로그인 사용자
내 ASP 로그인 컨트롤을 사용하여 문제가 있습니다. 내 web.config 파일에서 Forms 인증 모드를 설정하고 global.asax -> Application_BeginRequest 메서드에서 기록 된 사용자 데이터를 가져 오려고합니다.
.ASPX 코드 :
<asp:Login OnAuthenticate="Login1_Authenticate" ID="LoginUser" runat="server">
[...]
</asp:Login>
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Membership.ValidateUser(LoginUser.UserName, LoginUser.Password))
{
FormsAuthentication.SetAuthCookie(LoginUser.UserName, LoginUser.RememberMeSet);
}
}
의 Global.asax의 코드
protected void Application_BeginRequest(object sender, EventArgs e)
{
var usr = HttpContext.Current.User;
}
HttpContext.Current.User
속성이 null - 왜?