六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

ASP.NET中密碼保護

[摘要]你的主頁或者你管理的網站有各種密碼需要保護,把密碼直接放在數據庫或者文件中存在不少安全隱患,所以密碼加密后存儲是最常見的做法。在ASP.NET中實現加密非常容易。.NET SDK中提供了CookieAuthentication類,其中的HashPasswordForStoringInConfigF...

你的主頁或者你管理的網站有各種密碼需要保護,把密碼直接放在數據庫或者文件中存在不少安全隱患,所以密碼加密后存儲是最常見的做法。在ASP.NET中實現加密非常容易。.NET SDK中提供了CookieAuthentication類,其中的HashPasswordForStoringInConfigFile方法可直接使用MD5和SHA1算法。例子如下:
file: encrypting.aspx
<%@ Page language="c#" Codebehind="encrypting.cs" AutoEventWireup="false" Inherits="encrypting.encrypting" %>
<html><head>
   <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
   <meta name="CODE_LANGUAGE" Content="C#"></head>
 <body>



   <form method="post" runat="server">
<p>&nbsp;</p>
<p>
<asp:TextBox id=TextBox1 runat="server"></asp:TextBox>
<asp:Button id=Button1 runat="server" Text="encrypting"></asp:Button></p>
<p>Encrypting Password(MD5):
<asp:Label id=MD5 runat="server"></asp:Label></p>
    </form>



 </body></html>



file:encrypting.cs



namespace encrypting
{
   using System;
   using System.Collections;
   using System.ComponentModel;
   using System.Data;
   using System.Drawing;
   using System.Web;
   using System.Web.SessionState;
   using System.Web.UI;
   using System.Web.UI.WebControls;
   using System.Web.UI.HtmlControls;
   using System.Web.Security;
   /// <summary>
   ///    Summary description for encrypting.
   /// </summary>
   public class encrypting : System.Web.UI.Page
   {
 protected System.Web.UI.WebControls.Label MD5;
 protected System.Web.UI.WebControls.Button Button1;
 protected System.Web.UI.WebControls.TextBox TextBox1;



public encrypting()
{
    Page.Init += new System.EventHandler(Page_Init);
       }
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!IsPostBack)
           {
               //
               // Evals true first time browser hits the page
               //
           }
       }
       protected void Page_Init(object sender, EventArgs e)
       {
           //
           // CODEGEN: This call is required by the ASP+ Windows Form Designer.
           //
           InitializeComponent();
       }
       /// <summary>
       ///    Required method for Designer support - do not modify
       ///    the contents of this method with the code editor.
       /// </summary>
       private void InitializeComponent()
 {
  Button1.Click += new System.EventHandler (this.Button1_Click);
  this.Load += new System.EventHandler (this.Page_Load);
 }
 public void Button1_Click (object sender, System.EventArgs e)
 {
  MD5.Text = CookieAuthentication.HashPasswordForStoringInConfigFile(TextBox1.Text,"MD5");
  //SHA1 use CookieAuthentication.HashPasswordForStoringInConfigFile(TextBox1.Text,"SHA1");
 }
   }
}
注意:類CookieAuthentication的namespace是System.Web.Security。



主站蜘蛛池模板: 色美女影院 | 青草视频网 | 午夜国产高清精品一区免费 | 青青草原国产在线 | 四虎最新永久在线精品免费 | 亚洲专区欧美 | 青草青青在线视频 | 深夜视频在线播放视频在线观看免费观看 | 色天天综合久久久久综合片 | 特级生活片 | 伊人久久伊人 | 日本精品久久久久久久久免费 | 欧美性视频在线播放黑人 | 亚洲色网址 | 日本美女久久 | 色婷婷久久 | 午夜理理伦a级在线观看 | 色天使久久综合给合久久97色 | 五月婷婷激情四射 | 亚洲视频在线播放 | 青青国产成人久久激情91麻豆 | 天天干天天干天天 | 天天干在线免费视频 | 最新理论片 | 日本一区二区在线 | 欧美亚洲国产专区在线app | 无码中文资源在线播放 | 日韩一级欧美一级在线观看 | 色综合久久久久久888 | 在线97视频| 亚洲第一网站免费视频 | 欧美特黄一级大片 | 亚洲va久久久噜噜噜久久天堂 | 三级理论手机在线观看视频 | 亚洲激情视频在线播放 | 在线国产一区二区 | 中文字幕福利片 | 亚洲aav | 青青久在线视频免费观看 | 欧美一区在线播放 | 欧美一卡二卡三卡四卡 |