1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
//------------------------------------------------------------------------------
// <copyright file="WebContext.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Security.Permissions;
// WebContext
//
// Represents the WebContext that we are running within
//
public sealed class WebContext
{
private WebApplicationLevel _pathLevel;
private string _site;
private string _applicationPath;
private string _path;
private string _locationSubPath;
private string _appConfigPath;
// Constructor
//
//
public WebContext( WebApplicationLevel pathLevel,
string site,
string applicationPath,
string path,
string locationSubPath,
string appConfigPath )
{
_pathLevel = pathLevel;
_site = site;
_applicationPath = applicationPath;
_path = path;
_locationSubPath = locationSubPath;
_appConfigPath = appConfigPath;
}
//
// Retrieve the WebApplicationLevel we are being evaluated at
//
public WebApplicationLevel ApplicationLevel
{
get
{
return _pathLevel;
}
}
// Site
//
// What is the name of the Site we are in?
//
public string Site
{
get
{
return _site;
}
}
// ApplicationPath
//
// What is the Application Path for the Application we are
// being evaluated in
//
// Return Values:
// null - There is no application (ie. machine.config)
// path - The path of our application
//
public string ApplicationPath
{
get
{
return _applicationPath;
}
}
// Path
//
// What is the virtual path that we are being evaluated at?
//
public string Path
{
get
{
return _path;
}
}
// LocationSubPath
//
// What is the location sub path that we are being evaluated for?
// This will the same as the value inside the location tag
// in the config file
//
// Return Values:
// null - no associated location sub path.
// (This is still the case for ".", "" and it not being
// specified in the xml file)
// string - The location path from the config file, after
// normalization
//
public string LocationSubPath
{
get
{
return _locationSubPath;
}
}
// WOS 1955773: (Perf) 4,000 location sections in web.config file degrades working set
// Hack: this is the only way to get this to System.Configuration.BaseConfigurationRecord without introducing a new public API.
public override string ToString() {
return _appConfigPath;
}
}
}
|