fixed ParseServerVariables().
[mono.git] / mcs / class / System.Web / System.Web.Configuration / ModuleItem.cs
1 // 
2 // System.Web.Configuration.ModuleItem
3 //
4 // Author:
5 //   Patrik Torstensson (ptorsten@hotmail.com)
6 //
7 using System;
8
9 namespace System.Web.Configuration {
10         class ModuleItem {
11                 private Type _type;
12                 private string _typeName;
13                 private string _name;
14
15                 public ModuleItem(string name, string type) {
16                         _typeName = type;
17                         _name = name;
18
19                         _type = Type.GetType (type, true);
20                         if (!typeof(IHttpModule).IsAssignableFrom(_type))
21                                 throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
22                 }
23
24                 public ModuleItem(string name, Type type) {
25                         _typeName = type.ToString ();
26                         _name = name;
27                         _type = type;
28                         if (!typeof(IHttpModule).IsAssignableFrom(_type))
29                                 throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
30                 }
31
32                 public IHttpModule Create() {
33                         return (IHttpModule) HttpRuntime.CreateInternalObject(_type);
34                 }
35
36                 public Type Type {
37                         get {
38                                 return _type;
39                         }
40                 }
41
42                 public bool IsMatch (string name)
43                 {
44                         return (_type.Name == name || _type.FullName == name);
45                 }
46
47                 public string ModuleName {
48                         get {
49                                 return _name;
50                         }
51                 }
52         }
53 }