Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Deactivate Account and .set Identity.IsAuthenticated to false?

$
0
0

I need to know how to .set Identity.IsAuthenticated to false when i deactivate account?

I have a stored procedure that deactivates an account

the  is that i have on the page load

the following

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Me.Page.User.Identity.IsAuthenticated Then
            FormsAuthentication.RedirectToLoginPage()
        End If
    End Sub

on the deactivation.aspx below code

   Public Sub DeactivateUser()

        Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand("Deactivate_User")
                Using sda As New SqlDataAdapter()
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.Parameters.AddWithValue("@UserId", 33)
                    cmd.Parameters.AddWithValue("@ActivationCode", "16FD6024-D3F8-48A6-898B-67FF31B4E7F9")

                    cmd.Connection = con
                    con.Open()
                    cmd.ExecuteScalar()
                    con.Close()
                End Using
            End Using
            Dim message As String = String.Empty
        
                    message = "User Deactivated .\nUser Id: " + "33" 'userId.ToString()


            End Select

         '''''''''''''''''' '  Me.Page.User.Identity.IsAuthenticated = False   > I need to set authenticate false
           '''''''''''''''''' ' User.Identity.IsAuthenticated = False

            ClientScript.RegisterStartupScript([GetType](), "alert", (Convert.ToString("alert('") & message) + "');", True)
        End Using



    End Sub


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>