-1
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

Votes + Comments
code tags, wrong forum
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.