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

明輝手游網(wǎng)中心:是一個免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺!

ASP.NET中密碼保護(hù)

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

你的主頁或者你管理的網(wǎng)站有各種密碼需要保護(hù),把密碼直接放在數(shù)據(jù)庫或者文件中存在不少安全隱患,所以密碼加密后存儲是最常見的做法。在ASP.NET中實現(xiàn)加密非常容易。.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。



標(biāo)簽:ASP.NET中密碼保護(hù) 
主站蜘蛛池模板: 日本亚洲乱码中文字幕影院 | 亚洲欧美人妖另类激情综合区 | 一级十八以 下岁女子毛片 一级人做人爰a全过程免费视频 | 天天干天天射天天插 | 日本卡一卡2卡3卡4精品卡无人区 | 色视频网站色视频播放 | 在线小视频国产 | 日本中文在线观看 | 亚洲成人高清 | 婷婷色九月 | 亚洲精品另类有吗中文字幕 | 亚洲视频男人的天堂 | 亚洲综合九九 | 最新福利片v国产片 | 四虎精品影视 | 中文字幕免费高清视频 | 伊人久久91 | 天天久久狠狠色综合 | 四虎4hu永久免费国产精品 | 天堂资源地址在线 | 亚洲系列国产系列 | 四虎影永久在线高清免费 | 亚洲乱码一区二区三区国产精品 | 一区二区三区精品视频 | 深夜视频免费 | 亚洲专区区免费 | 青青国产成人久久91网站站 | 日本免费人成在线网站 | 亚洲成av人片在线观看 | 欧美性黑人极品hd网站 | 污视频在线观看视频 | 依人在线视频 | 日韩美女中文字幕 | 网友自拍第一页 | 午夜在线免费观看 | 午夜影院在线播放 | 亚洲国产精品一区二区久久hs | 欧美中文字幕一二三四区 | 亚洲图色网站 | 桃色成人精品网站 | 日本a天堂 |