Protected Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
If Session("LoginName") <> "" Then
Dim strCacheKey As String = Session("UserDetails").ToString()
Dim strUser As String = HttpContext.Current.Cache(strCacheKey).ToString()
End If
End Sub
i used this in global.asax and
If Not IsPostBack Then
Dim strConCat As String = txtLoginName.Text 'TxtUserName.Text + TxtPassword.Text
Dim strUser As String = Convert.ToString(Cache(strConCat))
If strUser = "" Or strUser.Equals(String.Empty) Then
Dim SessTimeOut As TimeSpan = New TimeSpan(0, 0, Session.Timeout, 0, 0)
Cache.Insert(strConCat, strConCat, Nothing, DateTime.MaxValue, SessTimeOut, CacheItemPriority.NotRemovable, Nothing)
Session("UserDetails") = strConCat
Response.Write("Welcome!")
Else
Response.Write("Duplicate login not allowed !!")
Return
End If
End If
in btnlogin
now i am getting exception "session not allowed in this file " in gllobal .asax page
what to do.can anyone help
thank you