易截截图软件、单文件、免安装、纯绿色、仅160KB

重置ASP.NET membership加密后的密码

这里我只摘取了原文的Code以供潜心研究.using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
using System.Data;
public partial class ResetPassword : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
// 重置
protected void btnReset_Click(object sender, EventArgs e)
{
string connStr = WebConfigurationManager.ConnectionStrings["conn"].ToString();
string username = txtUserName.Text.Trim();
if (username.Length==0)
{
Response.Write("请输入用户名!");
return;
}
//=== 产生加密用的密码密钥 ===
string salt = GenerateSalt();
//=== 将明码密码加密(此时密码为"P@ssw0rd" 当然也可随机数生成) ===
string password = EncryptToHashString("123456", salt, "SHA1");
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
//=== 在此我们呼叫 Membership 提供者 数据库里的预存程序来重置密码 ===
SqlCommand cmd = new SqlCommand("aspnet_Membership_SetPassword", conn);
cmd.CommandType = CommandType.StoredProcedure;
//=== 目前使用 Membership 提供者的 web 应用程序名称 ===
cmd.Parameters.Add(new SqlParameter("@ApplicationName", Membership.ApplicationName));
//=== 要重置密码的用户账号 ===
cmd.Parameters.Add(new SqlParameter("@UserName", username));
//=== 加密过的密码 ===
cmd.Parameters.Add(new SqlParameter("@NewPassword", password));
//=== 密码加密密钥(一定和使用加密密码的密钥一样,不要再重新产生) ===
cmd.Parameters.Add(new SqlParameter("@PasswordSalt", salt));
//=== 重置密码的时间 ===
cmd.Parameters.Add(new SqlParameter("@CurrentTimeUtc", DateTime.Now));
//=== 密码加密的格式(此时是Hash1,注意传入参数


相关文档:

关于 jquery Uploadify 上传插件 在 asp.net中 的使用

最近做网站用到了上传控件,找到了一个界面比较好看的 Uploadify
看到别人的文章学会使用 。原文地址:
http://doc.chinaunix.net/web/201001/304549.shtml
不是转帖,自己写写自己的。一个完整的解决方案。包括文件上传,文件信息获取和显示,语言:C#
Upload.aspx    //上传主页--主要是配置 jquery. ......

ASP.NET 脚本过滤 防止跨站脚本攻击

/// <summary>
    /// HTML解码
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public string HtmlDecode(string input)
  &nb ......

asp.net面试题


1:a=10,b=15,在不用第三方变量的前提下,把a,b的值互换
2:已知数组int[] max={6,5,2,9,7,4,0};用快速排序算法按降序对其进行排列,并返回数组
3:请简述面向对象的多态的特性及意义!
4:session喜欢丢值且占内存,Cookis不安全,请问用什么办法代替这两种原始的方法
5:对数据的并发采用什么办法进行处理较好。
6 ......

Asp.Net性能优化

(一).选择会话状态存储方式
    在Webconfig文件配置:
    <sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
         sqlConnectionString="data source=127.0.0.1;Trusted_Connection=y ......

ASP.NET与JavaScript交互

1.asp.net呼叫js
view
plain
copy
to clipboard
print
?
Response.Write("<mce:script language=javascript><!--  
");  
Response.Write("alert('欢迎您 ');"
 );  
Response.Write("location.href='login.aspx';"
)& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号