DotNet.UserCenter/Test.ashx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//-----------------------------------------------------------------------
// <copyright file="GetSignin.ashx" company="Hairihan">
//     Copyright (c) 2014 , All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

using System.Configuration;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web;

namespace DotNet.UserCenter
{
    using DotNet.Utilities;

    /// <summary>
    /// Test
    /// 测试数据库连接配置
    /// 
    /// 修改纪录
    /// 
    /// 2014-01-16 版本:2.0 JiRiGaLa 加密方式读取配置文件。
    /// 2014-01-09 版本:1.0 JiRiGaLa 创建。
    /// 
    /// <author>
    ///     <name>JiRiGaLa</name>
    ///     <date>2014-01-09</date>
    /// </author>
    /// </summary>
    public class Test : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string ip = DotNet.Business.Utilities.GetIPAddress();
            context.Response.Write("ip:" + ip);
            return;

            // 邮件内容       
            SmtpClient smtpClient = new SmtpClient(BaseSystemInfo.MailServer);
            smtpClient.UseDefaultCredentials = false;
            smtpClient.Credentials = new NetworkCredential(BaseSystemInfo.MailUserName, BaseSystemInfo.MailPassword);
            // 指定如何处理待发的邮件
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

            string email = "252056973@qq.com";
            string mailTitle = System.DateTime.Now.ToString() + " " + BaseSystemInfo.MailServer + " 测试服务器邮件配置正常 " + BaseSystemInfo.MailUserName;

            string mailBody = "邮件服务器运行正常" + System.Environment.NewLine
                            + "<br/> " + MachineInfo.GetIPAddress() + System.Environment.NewLine
                            + "<br/> " + System.DateTime.Now.ToString() + System.Environment.NewLine;

            // 发送邮件
            MailMessage mailMessage = new MailMessage(BaseSystemInfo.MailUserName, email, mailTitle, mailBody);
            mailMessage.BodyEncoding = Encoding.Default;
            mailMessage.IsBodyHtml = true;
            smtpClient.Send(mailMessage);

后面还有 38 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。