Asp.net源码专业站
首页->新知实践->UrlReWrite(Url重写或伪静态)完美示例源码>>UrlRewriter/URLRewriter.Config.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:UrlReWrite(Url重写或伪静态)完美示例源码
当前文件:文件类型 UrlReWriter/UrlRewriter/URLRewriter.Config.cs[2K,2009-6-12 11:57:50]打开代码结构图
普通视图
		            
1using System; 2using System.Configuration; 3using System.Collections; 4 5namespace URLRewriter.Config 6{ 7 // Define a custom section containing a simple element and a collection of the same element. 8 // It uses two custom types: UrlsCollection and UrlsConfigElement. 9 public class UrlsConfig 10 { 11 public static UrlsSection GetConfig() 12 { 13 return (UrlsSection)System.Configuration.ConfigurationManager.GetSection("CustomConfiguration"); 14 } 15 16 } 17 18 19 public class UrlsSection : ConfigurationSection 20 { 21 [ConfigurationProperty("urls",IsDefaultCollection = false)] 22 public UrlsCollection Urls 23 { 24 get 25 { 26 return (UrlsCollection)this["urls"]; 27 } 28 } 29 } 30 31 // Define the UrlsCollection that contains UrlsConfigElement elements. 32 public class UrlsCollection : ConfigurationElementCollection 33 { 34 protected override ConfigurationElement CreateNewElement() 35 { 36 return new UrlConfigElement(); 37 } 38 protected override Object GetElementKey(ConfigurationElement element) 39 { 40 return ((UrlConfigElement)element).VirtualUrl; 41 } 42 43 public UrlConfigElement this[int index] 44 { 45 get 46 { 47 return (UrlConfigElement)BaseGet(index); 48 } 49 } 50 51 } 52 53 // Define the UrlConfigElement. 54 public class UrlConfigElement : ConfigurationElement 55 { 56 57 58 [ConfigurationProperty("virtualUrl", IsRequired = true)] 59 public string VirtualUrl 60 { 61 get 62 { 63 return (string)this["virtualUrl"]; 64 } 65 set 66 { 67 this["virtualUrl"] = value; 68 } 69 } 70 71 [ConfigurationProperty("destinationUrl", IsRequired = true)] 72 public string DestinationUrl 73 { 74 get 75 { 76 return (string)this["destinationUrl"]; 77 } 78 set 79 { 80 this["destinationUrl"] = value; 81 } 82 } 83 } 84}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:UrlReWrite(Url重写或伪静态)完美示例源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146