default.aspx

来自「This is a book about vb.you could learn 」· ASPX 代码 · 共 63 行

ASPX
63
字号
<%@Page Language="VB" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Custom Forms-Based Authentication</title>
<style type="text/css">
body {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
input {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</style></head>
<body bgcolor="#ffffff">
<span class="heading">Custom Forms-Based Authentication</span><hr />
<!--------------------------------------------------------------------------->

<div id="msgHello" runat="server" /><p />

<form runat="server">
  <input type="submit" Value="Log Off" runat="server" onserverclick="DoSignOut" /><p />
</form>


<script language="VB" runat="server">

Sub Page_Load()

  'see if the user has been authenticated
  If User.Identity.IsAuthenticated Then

    'display the properties
    msgHello.InnerHtml = "Hello <b>" & User.Identity.Name & "</b><br />" _
                       & "The authentication method used was <b>" _
                       & User.Identity.AuthenticationType & "</b>"
  Else

    msgHello.InnerHtml = "Hello, you were not authenticated"

  End If

End Sub


Sub DoSignOut(objSender As Object, objArgs As EventArgs)

  'destroy the users authentication cookie
  FormsAuthentication.SignOut()

  'and redirect them to the login page
  Response.Clear()
  Response.Redirect(Request.UrlReferrer.ToString())

End Sub

</script>

<!--------------------------------------------------------------------------->
<hr /><span class="cite">&copy;2001 <a class="cite" href="http://www.wrox.com/">Wrox Press</a> -
<a class="cite" href="http://www.wrox.com/Books/Book_Details.asp?isbn=1861004885">Professional ASP.NET</a> (ISBN: 1-861004-88-5)</span>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?