asp.net中简单的邮件发送,供取回密码!
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Net.Configuration;
namespace BCore.PubFunction
{
public class MailHandler
{
public bool passwordToEmail(string usermail, string newpassword, string loginname)
{
try
{
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
System.Net.NetworkCredential credential = new System.Net.NetworkCredential(settings.Smtp.Network.UserName, settings.Smtp.Network.Password);
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
//msg.To.Add("itblackhole@163.com");//可以发送多人
msg.To.Add(usermail);
msg.from = new MailAddress("itblackhole@gmail.com", "*******", System.Text.Encoding.UTF8); /*3个参数分别是发件人地址(可以随便写),发件人姓名,编码*/
 
相关文档:
来源:草根站长
Cookie (HttpCookie的实例)提供了一种在 Web 应用程序中存储用户特定信息的方法。例如,当用户访问您的站点时,您可以使用Cookie 存储用户首选项或其他信息。当该用户再次访问您的网站时,应用程序便可以检索以前存储的信息。
ASP.NET中的cookie:创建Cookie方法 (1)
Response.Cookies["userName"].Valu ......
内容页访问MasterPage中的控件,有两种解决方案:
一、是用弱类型访问
使用 FindControl 方法获取模板页的控件
((Label)Master.FindControl("Label1")).Text = "xxx";
二、给模板页添加属性来使用强类型访问(推荐)
模板页定义;
&nb ......
在项目中我要用到修改密码功能,修改密码页我是用模式对话框的形式弹出来的,当我按正常情况提交数据时,发现它会弹出一个新的窗口来显示修改成功信息,我想提交数据而不打开新窗口,
我的解决办法就是在head标签中加上base标签让target="_self",之前我想得有点复杂,想给它一个固定的alert,当成功修改时才显示 ......
学asp.net不是很久,做了一个 OA 的项目,遇到很多问题,在此Mark一下,这些都是项目中经常遇到的问题,我搜集网上的解决方案,做了一个小的总结.也让遇到同样问题的IT学子有些帮助.
注: 人人为我,我为人人!
1、解决了 framework2.0 架构下 子页 内容 引用updatepanel 导致 ajax控件 警告为:未知元素,代码排版紊 ......