news.aspx

来自「asp.net技术内幕的书配源码」· ASPX 代码 · 共 50 行

ASPX
50
字号
<Script Runat="Server">

Sub Page_Load( s As Object, e As EventArgs )
  Dim objPassportID As PassportIdentity

  objPassportID = User.Identity
  If objPassportID.GetFromNetworkServer Then
    Response.Redirect( Request.Path )
  End If
  plhPassport.Controls.Add( New LiteralControl( objPassportID.LogoTag2() ) )
  If objPassportID.IsAuthenticated Then
    pnlAuth.Visible = True
  Else
    pnlAnon.Visible = True
  End If
End Sub
</Script>

<html>
<head><title>News.aspx</title></head>
<body>

<asp:PlaceHolder
  ID="plhPassport"
  Runat="Server" />
<hr>

<asp:Panel
  ID="pnlAuth"
  Visible="False"
  Runat="Server">

  <h2>Customized News</h2>
  News customized only for you...

</asp:Panel>

<asp:Panel
  ID="pnlAnon"
  Visible="False"
  Runat="Server">

  <h2>Anonymous News</h2>
  News for anonymous users...

</asp:Panel>

</body>
</html>

⌨️ 快捷键说明

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