发布于 2015-04-21 06:54:24 | 200 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

CMS内容管理系统

CMS是Content Management System的缩写,意为"内容管理系统"。 内容管理系统是企业信息化建设和电子政务的新宠,也是一个相对较新的市场。业界公认的国内比较权威的产品有思拓合众CmsTop、PHPCMS、TurboCMS。对于内容管理,业界还没有一个统一的定义,不同的机构有不同的理解。


1.UrlRewrite

protected void Application_BeginRequest(object sender, EventArgs e)
{
    //将请求的ShowArticle页面进行url重写
    string url = HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath;
    Match match = Regex.Match(url, @"~/Article/ShowArticle-(d+).aspx");
    if (match.Success)
    {
        long id = Convert.ToInt64(match.Groups[1].Value);
       HttpContext.Current.RewritePath("~/Article/ShowArticle.aspx?id=" + id);
    }
}

2.批量静态化

List<T_Articles> list = new T_ArticlesBLL().GetModelList("");
foreach (T_Articles model in list.ToArray())
{
    WebClient wb = new WebClient();
    wb.Encoding = Encoding.UTF8;
    string url = string.Format("http://{0}/Article/ShowArticle-{1}.aspx",Request.Url.Authority,model.Id);
    try
    {
        wb.DownloadFile(url,Server.MapPath(string.Format("~/Article/ShowArticle-{0}.html", model.Id)));          
    }
    catch(WebException wbex){
        CommonHelper.showMsg(Page, "下载id号为" + model.Id + "的页面时出错!" + wbex.Message);
        log.Error("下载id号为" + model.Id + "的页面时出错!" + wbex.Message);
    }      
}    

3.发送邮件

MailMessage mailMsg = new MailMessage();//两个类,别混了 引入System.Web这个Assembly
mailMsg.From = new MailAddress("[email protected]", "test");//源邮件地址
mailMsg.To.Add(new MailAddress("[email protected]", "jayjay"));//目的邮件地址。可以有多个收件人
mailMsg.Subject = "你好";//发送邮件的标题
mailMsg.Body = "你好";//发送邮件的内容
SmtpClient client = new SmtpClient("10.170.9.80");
client.Credentials = new NetworkCredential("jayjay", "123");
client.Send(mailMsg);


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务