⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx

📁 东软内部材料(四)asp等相关的教学案例 
💻 ASPX
字号:
<%@Page Language="C#" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Simple 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">Simple 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="C#" runat="server">

	void Page_Load(object sender, EventArgs e)
	{
		// see if the user has been authenticated
		if (User.Identity.IsAuthenticated)
		{
			// 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";

	}


	void DoSignOut(Object objSender, EventArgs objArgs)
	{
		// destroy the users authentication cookie
		FormsAuthentication.SignOut();

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

</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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -