Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ui / ScriptRegistrationManager.cs / 2 / ScriptRegistrationManager.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Text; using System.Text.RegularExpressions; using System.Web.UI; using System.Web.Resources; using System.Web.Script.Serialization; internal sealed class ScriptRegistrationManager { private static Regex ScriptTagRegex = new Regex( @"", indexOfEndOfScriptBeginTag, StringComparison.OrdinalIgnoreCase); if (indexOfScriptEndTag == -1) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ScriptRegistrationManager_NoCloseTag, activeRegistration.Type.FullName, activeRegistration.Key)); } string scriptBlockContents = scriptContent.Substring(indexOfEndOfScriptBeginTag, (indexOfScriptEndTag - indexOfEndOfScriptBeginTag)); // Turn the text content into a text attribute attrs.Add("text", scriptBlockContents); lastIndex = indexOfScriptEndTag + 9; } // Process all the explicit attributes on the script tag CaptureCollection attrnames = match.Groups["attrname"].Captures; CaptureCollection attrvalues = match.Groups["attrval"].Captures; for (int i = 0; i < attrnames.Count; i++) { string attribName = attrnames[i].ToString(); string attribValue = attrvalues[i].ToString(); // DevDev Bugs 123213: script elements registered with RegisterStartupScript are normally rendered // into the html of the page. Any html encoded values in the attributes are interpreted by the // browser, so the actual data is not html encoded. We must HtmlDecode any attribute values we find // here to remain consistent during async posts, since the data will be dynamically injected into // the dom, bypassing the browser's natural html decoding. attribValue = HttpUtility.HtmlDecode(attribValue); attrs.Add(attribName, attribValue); } // Serialize the attributes to JSON and write them out JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); string attrText = serializer.Serialize(attrs); PageRequestManager.EncodeString(writer, token, "ScriptContentWithTags", attrText); } CheckScriptTagTweenSpace(activeRegistration, scriptContent, lastIndex, scriptContent.Length - lastIndex); if (lastIndex == 0) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ScriptRegistrationManager_NoTags, activeRegistration.Type.FullName, activeRegistration.Key)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataControlFieldTypeEditor.cs
- XPathDocumentBuilder.cs
- ProjectedSlot.cs
- MultipleFilterMatchesException.cs
- OciHandle.cs
- XmlSchemaExternal.cs
- PeerToPeerException.cs
- EdmError.cs
- InvokePattern.cs
- OutOfProcStateClientManager.cs
- DiscoveryOperationContextExtension.cs
- RemoteWebConfigurationHostServer.cs
- NameValueConfigurationCollection.cs
- PlacementWorkspace.cs
- Int32CollectionConverter.cs
- CompareInfo.cs
- PeerEndPoint.cs
- XmlSchemaComplexType.cs
- FontUnit.cs
- URLMembershipCondition.cs
- DBCSCodePageEncoding.cs
- RankException.cs
- SizeFConverter.cs
- RegexRunnerFactory.cs
- Matrix.cs
- Size.cs
- IRCollection.cs
- XmlBuffer.cs
- DesignerLabelAdapter.cs
- StatusInfoItem.cs
- ObjectQueryExecutionPlan.cs
- XPathScanner.cs
- TraceHandlerErrorFormatter.cs
- BuildManagerHost.cs
- EtwTrace.cs
- ProcessModelInfo.cs
- Stream.cs
- DefaultEventAttribute.cs
- XhtmlBasicCalendarAdapter.cs
- AttributeParameterInfo.cs
- CodeCommentStatement.cs
- XsltQilFactory.cs
- UnknownBitmapEncoder.cs
- PersonalizationProvider.cs
- Comparer.cs
- ColorConvertedBitmap.cs
- httpserverutility.cs
- ResourceExpressionBuilder.cs
- CheckBoxField.cs
- StylusPoint.cs
- HandlerBase.cs
- DataReaderContainer.cs
- DataRowCollection.cs
- TextViewDesigner.cs
- WorkflowFormatterBehavior.cs
- TableLayoutPanel.cs
- InstanceNormalEvent.cs
- PropertyGridDesigner.cs
- lengthconverter.cs
- XpsFixedPageReaderWriter.cs
- PasswordBoxAutomationPeer.cs
- CapabilitiesSection.cs
- AutomationProperties.cs
- SettingsPropertyWrongTypeException.cs
- StylusLogic.cs
- UpdateManifestForBrowserApplication.cs
- WebResourceAttribute.cs
- EdmItemError.cs
- AttributeSetAction.cs
- ActiveDocumentEvent.cs
- AliasedSlot.cs
- ACL.cs
- followingsibling.cs
- SoapTransportImporter.cs
- DataBindingHandlerAttribute.cs
- ObjectStateEntry.cs
- LoadedEvent.cs
- ConstraintConverter.cs
- recordstate.cs
- CommandManager.cs
- DllHostInitializer.cs
- ByteViewer.cs
- CorrelationInitializer.cs
- VisualBasicDesignerHelper.cs
- BitmapMetadataEnumerator.cs
- SHA384.cs
- ActivitySurrogateSelector.cs
- EdmConstants.cs
- Size.cs
- XsdValidatingReader.cs
- Base64Stream.cs
- DbConnectionPoolCounters.cs
- NamespaceImport.cs
- AttachmentCollection.cs
- SettingsAttributes.cs
- CustomValidator.cs
- DoWhile.cs
- RouteItem.cs
- ObjectDataSourceDisposingEventArgs.cs
- NativeMethods.cs