home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / logout.aspx.vb < prev    next >
Text File  |  2010-08-24  |  4KB  |  198 lines

  1. Imports System.Data
  2. Imports System.Data.Common
  3. Imports System.Xml
  4. Imports System.IO
  5. Imports System.Data.OleDb
  6.  
  7. '
  8. ' ASP.NET code-behind class (Page)
  9. '
  10.  
  11. Partial Class _logout
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public logout As clogout
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class clogout
  21.         Inherits AspNetMakerPage
  22.         Implements IDisposable        
  23.  
  24.         ' Used by system generated functions
  25.         Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
  26.  
  27.         Private arwrk As Object
  28.  
  29.         Private armultiwrk() As String        
  30.  
  31.         ' Page URL
  32.         Public ReadOnly Property PageUrl() As String
  33.             Get
  34.                 Dim Url As String = ew_CurrentPage() & "?"
  35.                 Return Url    
  36.             End Get
  37.         End Property
  38.  
  39.         ' Validate page request
  40.         Public Function IsPageRequest() As Boolean
  41.             Return True            
  42.         End Function    
  43.  
  44.         '
  45.         '  Constructor
  46.         '  - init objects
  47.         '  - open connection
  48.         '
  49.         Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)                
  50.             m_ParentPage = APage
  51.             m_Page = Me    
  52.             m_PageID = "logout"
  53.             m_PageObjName = "logout"
  54.             m_PageObjTypeName = "clogout"
  55.  
  56.             ' Initialize table object
  57.             ' Connect to database
  58.  
  59.             Conn = New cConnection()
  60.         End Sub
  61.  
  62.         '
  63.         '  Subroutine Page_Init
  64.         '  - called before page main
  65.         '  - check Security
  66.         '  - set up response header
  67.         '  - call page load events
  68.         '
  69.         Public Sub Page_Init()
  70.             Security = New cAdvancedSecurity(Me)
  71.  
  72.             ' Global page loading event (in ewglobal*.vb)
  73.             ParentPage.Page_Loading()
  74.  
  75.             ' Page load event, used in current page
  76.             Page_Load()
  77.         End Sub
  78.  
  79.         '
  80.         '  Class terminate
  81.         '  - clean up page object
  82.         '
  83.         Public Sub Dispose() Implements IDisposable.Dispose
  84.             Page_Terminate("")
  85.         End Sub
  86.  
  87.         '
  88.         '  Sub Page_Terminate
  89.         '  - called when exit page
  90.         '  - clean up connection and objects
  91.         '  - if URL specified, redirect to URL
  92.         '
  93.         Sub Page_Terminate(url As String)
  94.  
  95.             ' Page unload event, used in current page
  96.             Page_Unload()
  97.  
  98.             ' Global page unloaded event (in ewglobal*.vb)
  99.             ParentPage.Page_Unloaded()
  100.  
  101.             ' Close connection
  102.             Conn.Dispose()
  103.             Security = Nothing
  104.  
  105.             ' Go to URL if specified
  106.             If url <> "" Then
  107.                 HttpContext.Current.Response.Clear()
  108.                 HttpContext.Current.Response.Redirect(url)
  109.             End If
  110.         End Sub
  111.  
  112.     '
  113.     ' Page main processing
  114.     '
  115.     Sub Page_Main()
  116.         Dim bValidate As Boolean = True
  117.         Dim sLastUrl As String, sUsername As String
  118.         sUsername = Security.CurrentUserName()
  119.  
  120.         ' User LoggingOut event
  121.         bValidate = User_LoggingOut(sUsername)
  122.         If Not bValidate Then
  123.             sLastUrl = Security.LastUrl
  124.             If sLastUrl = "" Then sLastUrl = "default.aspx"
  125.         Page_Terminate(sLastUrl) ' Go to last accessed URL
  126.         Else
  127.             If HttpContext.Current.Request.Cookies(EW_PROJECT_NAME) IsNot Nothing Then
  128.                 ew_Cookie("password") = "" ' Clear password
  129.                 ew_Cookie("lasturl") = "" ' Clear last URL
  130.                 If ew_Cookie("autologin") = "" Then ' Not auto login                    
  131.                     ew_Cookie("username") = "" ' Clear user name                
  132.                 End If
  133.             End If
  134.  
  135.             ' Clear session
  136.             HttpContext.Current.Session.Abandon()
  137.  
  138.             ' User_LoggedOut event
  139.             User_LoggedOut(sUsername)
  140.         Page_Terminate("login.aspx") ' Go to login page
  141.         End If
  142.     End Sub
  143.  
  144.         ' Page Load event
  145.         Public Sub Page_Load()
  146.  
  147.             'HttpContext.Current.Response.Write("Page Load")
  148.         End Sub
  149.  
  150.         ' Page Unload event
  151.         Public Sub Page_Unload()
  152.  
  153.             'HttpContext.Current.Response.Write("Page Unload")
  154.         End Sub
  155.  
  156.     ' User Logging Out event
  157.     Public Function User_LoggingOut(usr As String) As Boolean
  158.  
  159.         ' Enter your code here
  160.         ' To cancel, set return value to False
  161.  
  162.         Return True
  163.     End Function
  164.  
  165.     ' User Logged Out event
  166.     Public Sub User_LoggedOut(usr As String)
  167.  
  168.         'HttpContext.Current.Response.Write("User Logged Out")
  169.     End Sub
  170.     End Class
  171.  
  172.     '
  173.     ' ASP.NET Page_Load event
  174.     '
  175.  
  176.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  177.         Response.Buffer = EW_RESPONSE_BUFFER
  178.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  179.  
  180.         ' Page init
  181.         logout = New clogout(Me)        
  182.         logout.Page_Init()
  183.  
  184.         ' Page main processing
  185.         logout.Page_Main()
  186.     End Sub
  187.  
  188.     '
  189.     ' ASP.NET Page_Unload event
  190.     '
  191.  
  192.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  193.  
  194.         ' Dispose page object
  195.         If logout IsNot Nothing Then logout.Dispose()
  196.     End Sub
  197. End Class
  198.