Form based authentication - how to compile

Discussion in 'ASP.NET / ASP.NET Core' started by nature, Aug 19, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. How can I compile the following code into a DLL?
    I've tried all kinds of things to no avail. Thanks for any help you can provide.


    function IsAuthenticated() as boolean
    Dim objUserIdentity As FormsIdentity
    Dim objTicket As FormsAuthenticationTicket
    'objUserIdentity = User.Identity

    dim blnReturn as boolean
    If page.User.Identity.IsAuthenticated Then

    if page.User.Identity.name = session("strHostEmail") or session("strRole") = "A" then
    blnReturn = true
    else
    blnReturn = false
    end if
    lblLoginError.visible = false
    blnReturn = true

    ' response.write("session="&Session( "strSNRole" ) )
    else
    'response.write("not authenticated")
    blnReturn = false
    end if
    return blnReturn
    end function
     
  2. if you want to compile this funcation as seperate dll
    1. you have imports all the related namespace
    2. send page,session objects as a argument to you dll object
    3. use the following code

    function IsAuthenticated(page as System.Web.UI.Page,session as System.Web.SessionState.HttpSessionState) as boolean
    Dim objUserIdentity As FormsIdentity
    Dim objTicket As FormsAuthenticationTicket
    'objUserIdentity = User.Identity

    dim blnReturn as boolean
    If page.User.Identity.IsAuthenticated Then

    if page.User.Identity.name = session("strHostEmail") or session("strRole") = "A" then
    blnReturn = true
    else
    blnReturn = false
    end if
    lblLoginError.visible = false
    blnReturn = true

    ' response.write("session="&Session( "strSNRole" ) )
    else
    'response.write("not authenticated")
    blnReturn = false
    end if
    return blnReturn
    end function

    by
    the prince
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page