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

sknake commented: code tags, wrong forum -2

k.vijayakumar ,
Use code tags and post ASP.NET question in ASP.NET forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.