欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

注冊頁實現(xiàn)激活郵箱驗證(asp.net c#)

 更新時間:2013年04月26日 15:06:53   作者:  
在填寫注冊提交后,大一點的網(wǎng)站會有郵箱激活驗證這一步,本文也是實現(xiàn)了一下,感興趣的朋友可以參考下哈,希望可以幫助到你
-----------注冊頁前臺
復(fù)制代碼 代碼如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Registe.aspx.cs" Inherits="CSDN博客.Registe" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.zhuyi
{
color:Red;
font-size:small;
}
#pwd-strong {
float: left;
margin: 0px;
padding: 0px;
list-style: none;
background-image: url(images/pwdstrong.gif);
background-repeat: no-repeat;
}
#pwd-strong li {
float: left;
padding: 0px;
color: #ccc;
font-size: 11px;
width: 64px;
height: 10px;
text-align: center;
padding-top: 9px;
}
.pwds3 {
background-position: -20px -70px;
}
.pwds2 {
background-position: -20px -44px;
}
.pwds1 {
background-position: -20px -18px;
}
#pwd-strong li.currs {
color: #000;
}
/*頭部css樣式*/
#head
{
margin:0;
}
#head a:hover
{
color:Red;
}
.ahead
{
color:black;
font-size:small;
text-decoration:none;
}
#lefthead
{
float:left;
margin:0;
}
#righthead
{
float:right;
margin:0;
}
/*頭部css樣式結(jié)束*/
/*信息部分開始*/
#body
{
/*
border: 1px solid black;
*/
position:absolute;
width:900px;
height:700px;
left:230px;
top:50px;
}
#picture
{
float:left;
}
#xinxi
{
border:1px solid pink;
width:850px;
height:440px;
position:absolute;
left:20px;
top:50px
}
#biaoti
{
position:absolute;
left:1px;
top:10px;
}
#xian
{
position:absolute;
left:20px;
top:50px;
}
#table
{
position:absolute;
/*
border:1px solid black;
*/
left:50px;
top:90px;
}
/*信息部分結(jié)束*/
/*底部開始*/
#footer
{
/*
border:1px solid black;
*/
position:absolute;
left:430px;
top:560px;
}
.buttom
{
margin:0px;
font-size:small;
}
.abuttom
{
text-decoration:none;
color:Black;
}
#footer a:hover
{
color:Blue;
}
img
{
border:0px;
}
/*底部結(jié)束*/
</style>
<script src="emailvalidatorjs.js" type="text/javascript"></script>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#txtPassword').keyup(function () {
var score = testpass($(this).val());
if (score < 34) {
$('#pwd-strong').css('display', 'block');
$('#pwd-strong').addClass('pwds1');
$('li:first').addClass('currs');
}
else if (score >= 34 && score < 68) {
$('#pwd-strong').css('display', 'block');
$('#pwd-strong').removeClass();
$('#pwd-strong').addClass('pwds2');
$('li:eq(1)').addClass('currs');
}
else {
$('#pwd-strong').css('display', 'block');
$('#pwd-strong').removeClass();
$('#pwd-strong').addClass('pwds3');
$('li:last').addClass('currs');
}
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<!--內(nèi)容-->
<div>
<!--頭部-->
<div id="head">
<!--頭部左-->
<div id="lefthead">
<a class="ahead">首頁</a>
<a class="ahead">業(yè)界</a>
<a class="ahead">移動</a>
<a class="ahead">云計算</a>
<a class="ahead">研發(fā)</a>
<a class="ahead">論壇</a>
<a class="ahead">博客</a>
<a class="ahead">下載</a>
<a class="ahead">更多</a>
</div>
<!--頭部右-->
<div id="righthead">
<span class="zhuyi">你還未登陸!</span>|&nbsp
<a class="ahead">登陸</a>&nbsp&nbsp|&nbsp
<a class="ahead">注冊</a>&nbsp&nbsp|&nbsp
<a class="ahead">幫助</a>
</div>
</div>
<!--頭部結(jié)束-->
<!--身體-->
<div id="body" >
<!--圖片-->
<div id="picture">
<img src="images/zhuce.gif" />
</div>
<!--信息-->
<div id="xinxi">
<div id="biaoti">
<img src="images/zhuce1.gif"/>
</div>
<div id="xian">
<img src="images/zhuce2.png" />
</div>
<div id="table">
<table>
<!--用戶名-->
<tr>
<td><span class="zhuyi">*</span>用戶名:</td>
<td>
<asp:TextBox ID="txtName" runat="server" ControlToValidate="TextBox1"></asp:TextBox></td>
<td >
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="用戶名不能為空" ControlToValidate="txtName" Display="Dynamic"
Font-Size="15px" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr><td></td><td colspan="2">
<label style="color:#c0c0c0;font-size:small;">(字母、數(shù)字或下劃線組合。)</label></td></tr>
<!--密碼-->
<tr>
<td><span class="zhuyi">*</span>密碼:</td>
<td>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtPassword" Display="Dynamic" ErrorMessage="不能為空"
Font-Size="15px" ForeColor="Red"></asp:RequiredFieldValidator>
<div><ul id="pwd-strong" style="display: none;"><li>弱</li><li>中</li><li>強(qiáng)</li></ul></div></td>
</tr>
<tr><td></td><td colspan="2">
<label style="color:#c0c0c0;font-size:small;">(為了您的帳戶安全,強(qiáng)烈建議您的密碼使用字符+數(shù)字等多種不同類型的組合,并且密碼長度大于5位。)</label></td></tr>
<!--再次輸入密碼-->
<tr>
<td><span class="zhuyi">*</span>再次輸入密碼:</td>
<td>
<asp:TextBox ID="txtPasswordAgain" runat="server"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtPassword" Display="Dynamic" ErrorMessage="不能為空"
ForeColor="Red" Font-Size="15px"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="兩次輸入的密碼不一致" ControlToCompare="txtPassword"
ControlToValidate="txtPasswordAgain" Display="Dynamic" ForeColor="Red"
Font-Size="15px"></asp:CompareValidator></td>
</tr>
<tr><td></td><td colspan="2">
<label style="color:#c0c0c0;font-size:small;">(請確保密碼正確)</label></td></tr>
<!--E-mail-->
<tr>
<td><span class="zhuyi">*</span>E-mail</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="不能為空"
ForeColor="Red" Font-Size="15px"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="郵箱格式不正確"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ForeColor="Red" Font-Size="15px"></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td></td><td colspan="2">
<label style="color:#c0c0c0;font-size:small;">(請?zhí)顚懩S玫泥]箱)</label></td></tr>
<!--驗證碼-->
<tr>
<td><span class="zhuyi">*</span>校驗碼:</td>
<td>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></td>
<td>
<img src="checkCode.aspx" onclick="this.src='checkCode.aspx?aaa='+new Date()" alt="" />圖片看不清?點擊重新得到驗證碼
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="TextBox5" Display="Dynamic" ErrorMessage="不能為空"></asp:RequiredFieldValidator>
</td>
</tr>
<tr><td></td><td colspan="2">
<span class="zhuyi">(如您連續(xù)輸入不對驗證碼,請檢查您的瀏覽器是否禁用了Cookie。<a >如何啟用Cookie?</a>)</span></td></tr>
<tr>
<!--條款-->
<td><span class="zhuyi">*</span>注冊條款:</td>
<td colspan="2">
<asp:CheckBox ID="CheckBox1" runat="server"
oncheckedchanged="CheckBox1_CheckedChanged" Text="我已仔細(xì)閱讀并接受" /><a >CSDN注冊條款</a>。</td>
</tr>
<!--注冊提交-->
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr>
<td></td>
<td colspan="2">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/images/zhuce.jpg" onclick="ImageButton1_Click" />
<asp:Label ID="lbinfo" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
<div>
</div>
</div>
</div>
</div>
<!--身體結(jié)束-->
<!--底部-->
<div id="footer" align="center">
<div class="buttom">
<a class="abuttom">公司簡介</a>|
<a class="abuttom" >招賢納士</a>|
<a class="abuttom">廣告服務(wù)</a>|
<a class="abuttom">銀行匯款賬號</a>|
<a class="abuttom">聯(lián)系方式</a>|
<a class="abuttom">版權(quán)聲明</a>|
<a class="abuttom">法律顧問</a>|
<a href="" class="abuttom">問題報告</a>
</div>
<p class="buttom">京&nbsp&nbspICP&nbsp&nbsp證&nbsp&nbsp070598&nbsp&nbsp號</p>
<p class="buttom">北京創(chuàng)新樂知信息技術(shù)有限公司&nbsp&nbsp版權(quán)所有</p>
<p class="buttom"><img src="images/zhuce4.gif" />聯(lián)系郵箱:webmaster(at)csdn.net</p>
<p class="buttom">Copyright&nbsp©&nbsp1999-2012,&nbspCSDN.NET,&nbspAll&nbspRights&nbspReserved</p>
<div>
<a class="abuttom"><img src="images/denglu2.gif"/></a>
<a class="abuttom"><img src="images/denglu1.gif"/></a>
</div>

------注冊頁后臺
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Net.Mail;
using System.Net;
using System.Data.SqlClient;
namespace CSDN博客
{
public partial class Registe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
}
public void sendMail(string email, string activeCode)
{
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("15031259715@163.com");
mailMsg.To.Add(email);
mailMsg.Subject = "請激活注冊";
int number = number1();
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.Append("請單擊以下鏈接完成激活");
contentBuilder.Append("<a href='http://localhost:15464/cheng.aspx?activecode=" + activeCode + "&id=" + number + "'>激活</a>");
mailMsg.Body = contentBuilder.ToString();//拼接字符串
mailMsg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
//發(fā)件方服務(wù)器地址
client.Host = "smtp.163.com";
client.Port = 25;
//mailMsg.IsBodyHtml = true;
NetworkCredential credetial = new NetworkCredential();
credetial.UserName = "15031259715";
credetial.Password = "wangjing911214++";
client.Credentials = credetial;
client.Send(mailMsg);
}
public int number1()
{
CSDN博客.BLL.T_User count = new BLL.T_User();
int a = count.GetRecordCount("");
return a;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
CSDN博客.Model.T_User muser = new Model.T_User();
muser.Name = txtName.Text;
muser.Password = txtPassword.Text;
muser.E_Mail = txtEmail.Text;
string activecode=Guid.NewGuid().ToString().Substring(0, 8);
muser.ActiveCode = activecode;//生成激活碼
CSDN博客.BLL.T_User buser = new BLL.T_User();
if (buser.Add(muser) > 0)
{
sendMail(txtEmail.Text, activecode);//給注冊用戶發(fā)郵件
lbinfo.Text = "保存成功";
}
else { lbinfo.Text = "保存失敗"; }
}
}
}
</div>
<!--底部結(jié)束-->
</div>
</form>
</body>
</html>

------------激活驗證
復(fù)制代碼 代碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace CSDN博客
{
public partial class cheng : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//取出參數(shù)id
int id = Convert.ToInt32(Request["id"]);
string activeCode = Request["activecode"].ToString();
//2判斷id為id的記錄是否存在
//連接數(shù)據(jù)庫
string conStr = "data source=LOVE-PC\\SQLEXPRESSPC;initial catalog=Blogs;user id=sa;password=admin";
int number;
using (SqlConnection con = new SqlConnection(conStr))
{
string sql = "select count(*) from T_User where Id=@id";
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
cmd.Parameters.AddWithValue("@id", id);
number = Convert.ToInt32(cmd.ExecuteScalar());
}
}
if (number > 0)
{
//如果該用戶存在取出ActiveCode字段進(jìn)行比較。如果一樣,把Active字段修改為true
//連接數(shù)據(jù)庫
string AC;
using (SqlConnection con = new SqlConnection(conStr))
{
string sql = "select ActiveCode from T_User where Id=@id";
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
cmd.Parameters.AddWithValue("@id", id);
AC = cmd.ExecuteScalar().ToString(); ;
}
}
if (activeCode == AC)
{
Response.Write("激活成功!<a href='denglu.aspx'>返回登錄</a>");
using (SqlConnection con = new SqlConnection(conStr))
{
string sql = "update T_User set Active=1 where Id=@id";
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
cmd.Parameters.AddWithValue("@id", id);
number = Convert.ToInt32(cmd.ExecuteScalar());
}
}
}
else
{
Response.Write("用戶已存在,但是激活碼錯誤!");
}
}
else
{
Response.Write("用戶不存在,還沒注冊成功!");
}
}
}
}

實現(xiàn)如下效果:

相關(guān)文章

  • MVC4制作網(wǎng)站教程第四章 瀏覽欄目4.2

    MVC4制作網(wǎng)站教程第四章 瀏覽欄目4.2

    這篇文章主要為大家詳細(xì)介紹了MVC4制作網(wǎng)站教程,瀏覽欄目功能實現(xiàn)代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-08-08
  • .NET core 3.0如何使用Jwt保護(hù)api詳解

    .NET core 3.0如何使用Jwt保護(hù)api詳解

    這篇文章主要給大家介紹了關(guān)于.NET core 3.0如何使用Jwt保護(hù)api的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用.NET core 3.0具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-11-11
  • asp.net簡單生成驗證碼的方法

    asp.net簡單生成驗證碼的方法

    這篇文章主要介紹了asp.net簡單生成驗證碼的方法,涉及asp.net生成隨機(jī)數(shù)與繪制圖片的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-11-11
  • ASP.NET?MVC實現(xiàn)路由功能

    ASP.NET?MVC實現(xiàn)路由功能

    這篇文章介紹了ASP.NET?MVC實現(xiàn)路由功能的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-08-08
  • Jwt通過源碼揭秘隱藏大坑

    Jwt通過源碼揭秘隱藏大坑

    今天分享一下在使用JWT在項目中遇到的一個問題,主要是一個協(xié)議的細(xì)節(jié),非常容易被忽略,如果不是自己遇到,或者去看源碼的實現(xiàn),我估計至少80%的人都會栽在這里,下面來還原一下這個問題的過程,由于這個問題出現(xiàn)有一定的概率,不是每次都會出現(xiàn),所以才容易掉坑里
    2022-05-05
  • .NET CORE動態(tài)調(diào)用泛型方法詳解

    .NET CORE動態(tài)調(diào)用泛型方法詳解

    這篇文章主要為大家詳細(xì)介紹了.NET CORE動態(tài)調(diào)用泛型方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-08-08
  • asp.net結(jié)合Ajax驗證用戶名是否存在的代碼

    asp.net結(jié)合Ajax驗證用戶名是否存在的代碼

    關(guān)于Ajax的操作簡單總結(jié),結(jié)合Ajax驗證用戶名是否存在的代碼
    2010-06-06
  • 對asp.net緩存 的深入了解

    對asp.net緩存 的深入了解

    本篇文章,小編將為大家介紹,對asp.net緩存的深入了解。有需要的朋友可以參考一下
    2013-04-04
  • ASP.NET環(huán)境下為網(wǎng)站增加IP過濾功能

    ASP.NET環(huán)境下為網(wǎng)站增加IP過濾功能

    通過深入的交流和溝通,確認(rèn)了該發(fā)電廠在企業(yè)網(wǎng)站用戶訪問控制方面的改進(jìn)要求
    2009-06-06
  • asp.net 頁面間傳值與跳轉(zhuǎn)的區(qū)別

    asp.net 頁面間傳值與跳轉(zhuǎn)的區(qū)別

    通過Server.Transfer("b.aspx") 與Response.Redirect("b.aspx")的區(qū)別
    2010-04-04

最新評論