Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Configuration / CapabilitiesState.cs / 1 / CapabilitiesState.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Collections; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Security; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Web.Caching; using System.Web.Compilation; using System.Web.Hosting; using System.Security.Permissions; // // Encapsulates the evaluation state used in computing capabilities // internal class CapabilitiesState { internal HttpRequest _request; internal IDictionary _values; internal ArrayList _matchlist; internal ArrayList _regexlist; internal bool _exit; internal bool _evaluateOnlyUserAgent; internal CapabilitiesState(HttpRequest request, IDictionary values) { _request = request; _values = values; _matchlist = new ArrayList(); _regexlist = new ArrayList(); } internal bool EvaluateOnlyUserAgent { get { return _evaluateOnlyUserAgent; } set { _evaluateOnlyUserAgent = value; } } internal virtual void ClearMatch() { if (_matchlist == null) { _regexlist = new ArrayList(); _matchlist = new ArrayList(); } else { _regexlist.Clear(); _matchlist.Clear(); } } internal virtual void AddMatch(DelayedRegex regex, Match match) { _regexlist.Add(regex); _matchlist.Add(match); } internal virtual void PopMatch() { _regexlist.RemoveAt(_regexlist.Count - 1); _matchlist.RemoveAt(_matchlist.Count - 1); } internal virtual String ResolveReference(String refname) { if (_matchlist == null) return String.Empty; int i = _matchlist.Count; while (i > 0) { i--; int groupnum = ((DelayedRegex)_regexlist[i]).GroupNumberFromName(refname); if (groupnum >= 0) { Group group = ((Match)_matchlist[i]).Groups[groupnum]; if (group.Success) { return group.ToString(); } } } return String.Empty; } [AspNetHostingPermission(SecurityAction.Assert, Level=AspNetHostingPermissionLevel.Low)] string ResolveServerVariableWithAssert(string varname) { string result = _request.ServerVariables[varname]; if (result == null) return string.Empty; return result; } internal virtual String ResolveServerVariable(String varname) { if (varname.Length == 0 || varname == "HTTP_USER_AGENT") return HttpCapabilitiesEvaluator.GetUserAgent(_request); if (EvaluateOnlyUserAgent) return string.Empty; return ResolveServerVariableWithAssert(varname); } internal virtual String ResolveVariable(String varname) { String result; result = (String)_values[varname]; if (result == null) return String.Empty; return result; } internal virtual void SetVariable(String varname, String value) { _values[varname] = value; } internal virtual bool Exit { get { return _exit; } set { _exit = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Collections; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Security; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Web.Caching; using System.Web.Compilation; using System.Web.Hosting; using System.Security.Permissions; // // Encapsulates the evaluation state used in computing capabilities // internal class CapabilitiesState { internal HttpRequest _request; internal IDictionary _values; internal ArrayList _matchlist; internal ArrayList _regexlist; internal bool _exit; internal bool _evaluateOnlyUserAgent; internal CapabilitiesState(HttpRequest request, IDictionary values) { _request = request; _values = values; _matchlist = new ArrayList(); _regexlist = new ArrayList(); } internal bool EvaluateOnlyUserAgent { get { return _evaluateOnlyUserAgent; } set { _evaluateOnlyUserAgent = value; } } internal virtual void ClearMatch() { if (_matchlist == null) { _regexlist = new ArrayList(); _matchlist = new ArrayList(); } else { _regexlist.Clear(); _matchlist.Clear(); } } internal virtual void AddMatch(DelayedRegex regex, Match match) { _regexlist.Add(regex); _matchlist.Add(match); } internal virtual void PopMatch() { _regexlist.RemoveAt(_regexlist.Count - 1); _matchlist.RemoveAt(_matchlist.Count - 1); } internal virtual String ResolveReference(String refname) { if (_matchlist == null) return String.Empty; int i = _matchlist.Count; while (i > 0) { i--; int groupnum = ((DelayedRegex)_regexlist[i]).GroupNumberFromName(refname); if (groupnum >= 0) { Group group = ((Match)_matchlist[i]).Groups[groupnum]; if (group.Success) { return group.ToString(); } } } return String.Empty; } [AspNetHostingPermission(SecurityAction.Assert, Level=AspNetHostingPermissionLevel.Low)] string ResolveServerVariableWithAssert(string varname) { string result = _request.ServerVariables[varname]; if (result == null) return string.Empty; return result; } internal virtual String ResolveServerVariable(String varname) { if (varname.Length == 0 || varname == "HTTP_USER_AGENT") return HttpCapabilitiesEvaluator.GetUserAgent(_request); if (EvaluateOnlyUserAgent) return string.Empty; return ResolveServerVariableWithAssert(varname); } internal virtual String ResolveVariable(String varname) { String result; result = (String)_values[varname]; if (result == null) return String.Empty; return result; } internal virtual void SetVariable(String varname, String value) { _values[varname] = value; } internal virtual bool Exit { get { return _exit; } set { _exit = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- processwaithandle.cs
- mongolianshape.cs
- UnsafePeerToPeerMethods.cs
- NativeCppClassAttribute.cs
- TaskFormBase.cs
- SqlDataSourceConfigureSelectPanel.cs
- NumericUpDownAcceleration.cs
- HtmlInputHidden.cs
- MetadataItem_Static.cs
- ButtonBaseAdapter.cs
- EntityDataSourceWizardForm.cs
- XmlBinaryWriter.cs
- PartDesigner.cs
- DashStyle.cs
- ProviderCollection.cs
- ScriptingSectionGroup.cs
- fixedPageContentExtractor.cs
- EvidenceTypeDescriptor.cs
- EditableTreeList.cs
- DataGridViewRowCollection.cs
- FSWPathEditor.cs
- SmtpLoginAuthenticationModule.cs
- OneOfConst.cs
- SqlClientFactory.cs
- Normalization.cs
- BrushConverter.cs
- TokenCreationParameter.cs
- ParentQuery.cs
- WebServiceHandler.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- TextChange.cs
- TimeZone.cs
- IxmlLineInfo.cs
- AssociatedControlConverter.cs
- OrderByLifter.cs
- UnsafeNativeMethodsTablet.cs
- MD5.cs
- GenerateTemporaryTargetAssembly.cs
- DateTimeFormatInfoScanner.cs
- PageBuildProvider.cs
- FontStyles.cs
- DrawingImage.cs
- AnonymousIdentificationSection.cs
- HttpProtocolImporter.cs
- TextElement.cs
- Nullable.cs
- SamlDelegatingWriter.cs
- LineBreak.cs
- CharStorage.cs
- EditBehavior.cs
- OracleMonthSpan.cs
- DbParameterHelper.cs
- SQLStringStorage.cs
- Processor.cs
- ToolStripItem.cs
- SQLStringStorage.cs
- ServiceEndpointElementCollection.cs
- BaseCodePageEncoding.cs
- BamlStream.cs
- UnicodeEncoding.cs
- SqlCachedBuffer.cs
- GridViewRow.cs
- Completion.cs
- SystemFonts.cs
- MobileFormsAuthentication.cs
- WebProxyScriptElement.cs
- _Events.cs
- DataGridViewCellMouseEventArgs.cs
- XmlUtil.cs
- PathFigure.cs
- RenderData.cs
- RuntimeWrappedException.cs
- ToolStripHighContrastRenderer.cs
- GenericsNotImplementedException.cs
- FormsAuthenticationConfiguration.cs
- AudioLevelUpdatedEventArgs.cs
- HttpModulesSection.cs
- Flowchart.cs
- HostSecurityManager.cs
- RoamingStoreFile.cs
- XamlPoint3DCollectionSerializer.cs
- UrlAuthorizationModule.cs
- ErasingStroke.cs
- DeploymentSectionCache.cs
- InlineObject.cs
- ColorPalette.cs
- ApplicationHost.cs
- SoapDocumentServiceAttribute.cs
- TabControl.cs
- Environment.cs
- EntitySet.cs
- PersonalizationProvider.cs
- InheritanceContextChangedEventManager.cs
- ParentUndoUnit.cs
- ListChunk.cs
- Automation.cs
- SingleObjectCollection.cs
- PropertyChangedEventManager.cs
- FlowNode.cs
- LineProperties.cs