Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / ScriptRegistrationManager.cs / 1305376 / 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.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Web.Handlers; using System.Web.Resources; using System.Web.Script.Serialization; using System.Web.UI; 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 = new JavaScriptSerializer(); 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Constants.cs
- NameTable.cs
- XmlNodeComparer.cs
- RemotingSurrogateSelector.cs
- ForceCopyBuildProvider.cs
- StorageAssociationSetMapping.cs
- TagMapCollection.cs
- RefType.cs
- RegexWriter.cs
- Message.cs
- WinFormsSecurity.cs
- XmlUtil.cs
- GenericsInstances.cs
- CodeTryCatchFinallyStatement.cs
- BitConverter.cs
- ColorDialog.cs
- EmptyReadOnlyDictionaryInternal.cs
- RadioButton.cs
- HelpEvent.cs
- EnterpriseServicesHelper.cs
- EncoderParameter.cs
- XmlNodeChangedEventManager.cs
- DependencyObjectProvider.cs
- ChannelDemuxer.cs
- Exceptions.cs
- EntityClientCacheKey.cs
- DesignerActionItemCollection.cs
- RawAppCommandInputReport.cs
- X509CertificateClaimSet.cs
- GPRECT.cs
- TextBoxAutomationPeer.cs
- DeferredElementTreeState.cs
- COM2EnumConverter.cs
- FormView.cs
- ScriptResourceAttribute.cs
- SecurityDescriptor.cs
- ImageAttributes.cs
- EditorBrowsableAttribute.cs
- ReachBasicContext.cs
- Attributes.cs
- ReachDocumentSequenceSerializer.cs
- ObjectPropertyMapping.cs
- BaseParser.cs
- FreezableDefaultValueFactory.cs
- WebPartDisplayModeCancelEventArgs.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- PackagePartCollection.cs
- GroupQuery.cs
- LazyTextWriterCreator.cs
- EpmHelper.cs
- EqualityComparer.cs
- OracleSqlParser.cs
- DataSourceControlBuilder.cs
- SettingsPropertyNotFoundException.cs
- JsonQNameDataContract.cs
- WindowsRegion.cs
- TrustLevelCollection.cs
- TextServicesCompartmentContext.cs
- FontNameConverter.cs
- CancellationHandler.cs
- ScopeCollection.cs
- QueryResults.cs
- GeometryConverter.cs
- TextProperties.cs
- HttpApplicationFactory.cs
- Deserializer.cs
- TemplateEditingVerb.cs
- ControlParser.cs
- KeyPressEvent.cs
- ExpressionBuilderContext.cs
- DbSetClause.cs
- RuntimeIdentifierPropertyAttribute.cs
- MasterPageCodeDomTreeGenerator.cs
- TransactionInterop.cs
- SizeConverter.cs
- EncoderFallback.cs
- FixedSOMTableRow.cs
- RenderCapability.cs
- DataSourceUtil.cs
- WebMessageEncodingBindingElement.cs
- FormConverter.cs
- DateTimeParse.cs
- DeviceContext.cs
- IDispatchConstantAttribute.cs
- KeyFrames.cs
- BitmapEffectrendercontext.cs
- _SslStream.cs
- HttpResponse.cs
- assertwrapper.cs
- ExtensionWindow.cs
- CookielessHelper.cs
- FontWeight.cs
- ViewManager.cs
- OleDbStruct.cs
- linebase.cs
- Byte.cs
- GridEntryCollection.cs
- PeerNameRecordCollection.cs
- ExceptionValidationRule.cs
- LocalTransaction.cs