Advertisement
imjyb1008work

Default.aspx.cs

May 14th, 2019
2,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8.  
  9. namespace WebApplication1
  10. {
  11.     public partial class _Default : System.Web.UI.Page
  12.     {
  13.         protected void Page_Load(object sender, EventArgs e)
  14.         {
  15.             if (User.Identity.IsAuthenticated)
  16.             {
  17.                 Response.Write("您現在是已登入狀態。");
  18.             }
  19.         }
  20.  
  21.         protected void btnLogout_Click(object sender, EventArgs e)
  22.         {
  23.             FormsAuthentication.SignOut();
  24.             Response.Redirect(FormsAuthentication.LoginUrl);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement