前段时间,在项目的管理员后台做了一个简单的关键字读写的模块。这个模块采用ASP.NET MVC 2.0,主要实现的功能是管理员可以在后台将需要的关键字写入到指定路径的一个txt文件里面。然后项目其他站点通过这个读取这个文件,获取需要过滤的关键字,对站点用户输入的内容做判断。

1.首先在管理员后台新建一个Area,命名为KeyWord.KeyWord的目录结构和根目录下的Controllers,Models,Views是一样的,唯一的区别是在KeyWord目录下多了一个KeyWordAreaRegistration.cs文件。它继承自AreaRegistration类,KeyWordAreaRegistration必须实现AreaRegistration类中的AreaName属性和RegisterArea(AreaRegistrationContext context)方法.

关键字读写模块关键字读写模块

KeyWordAreaRegistration.cs代码如下所示:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
   6:  
namespace QQYDT.Admin.Areas.KeyWord
   8: {
class KeyWordAreaRegistration : AreaRegistration
  10:     {
string AreaName
  12:         {
  13:             get
  14:             {
;
  16:             }
  17:         }
  18:  
void RegisterArea(AreaRegistrationContext context)
  20:         {
  21:             context.MapRoute(
,
,
, id = UrlParameter.Optional },
 }
  26:             );
  27:         }
  28:     }
  29: }

相关文章:

  • 2021-11-03
  • 2021-06-02
  • 2021-12-04
  • 2021-10-20
  • 2021-11-11
  • 2022-12-23
  • 2021-10-18
猜你喜欢
  • 2021-11-08
  • 2021-11-07
  • 2021-04-22
  • 2021-07-04
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案