Simple Application of ticket

Source: Internet
Author: User

The Code is as follows:
Using System;
Using System. Data;
Using System. Configuration;
Using System. Collections;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. WebControls. WebParts;
Using System. Web. UI. HtmlControls;

Namespace www
Public partial class piaoju1: System. Web. UI. Page
Protected void Page_Load (object sender, EventArgs e)

// Set the user logon flag and associate it with the browser. The failure condition is that the browser is disabled.
Protected void btnSet_Click (object sender, EventArgs e)
System. Web. Security. FormsAuthentication. SetAuthCookie ("uName, uPower", false );
// Obtain the user name
Protected void btnGet_Click (object sender, EventArgs e)
Response. Write (HttpContext. Current. User. Identity. Name );
// Exit
Protected void btnLogout_Click (object sender, EventArgs e)
FormsAuthentication. SignOut ();
// Determine whether to log on
Protected void btnShow_Click (object sender, EventArgs e)
If (HttpContext. Current. User. Identity. IsAuthenticated)
Response. Write ("OK ");
Response. Write ("no ");

The Code is as follows:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "piaoju1.aspx. cs" Inherits = "www. piaoju1" %>

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "">

<Html xmlns = "">
<Head runat = "server">
<Title> simple use of a ticket </title>
<Form id = "form1" runat = "server">
<Asp: Button ID = "btnShow" runat = "server" Text = "show" OnClick = "btnShow_Click"/>
<Asp: Button ID = "btnSet" runat = "server" Text = "set" OnClick = "btnSet_Click"/>
<Asp: Button ID = "btnGet" runat = "server" Text = "get" OnClick = "btnGet_Click"/>
<Asp: Button ID = "btnLogout" runat = "server" Text = "out" OnClick = "btnLogout_Click"/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.