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
- TargetParameterCountException.cs
- KeyToListMap.cs
- GacUtil.cs
- XmlILAnnotation.cs
- ImageMapEventArgs.cs
- MessageDesigner.cs
- BatchServiceHost.cs
- PointConverter.cs
- MinMaxParagraphWidth.cs
- ConfigurationManagerInternal.cs
- StrokeCollectionDefaultValueFactory.cs
- DataTableNewRowEvent.cs
- SchemaNotation.cs
- ParsedAttributeCollection.cs
- ReadOnlyDictionary.cs
- ProfileParameter.cs
- HttpResponseInternalWrapper.cs
- PreservationFileWriter.cs
- ISessionStateStore.cs
- smtppermission.cs
- SecurityContext.cs
- PropertyItemInternal.cs
- ExtensionDataReader.cs
- MessageQueueCriteria.cs
- EnumerableWrapperWeakToStrong.cs
- ZeroOpNode.cs
- MarshalDirectiveException.cs
- TemplateBamlTreeBuilder.cs
- ObjectConverter.cs
- Point3DConverter.cs
- XmlCDATASection.cs
- ComplexObject.cs
- PersistNameAttribute.cs
- RadioButtonFlatAdapter.cs
- safemediahandle.cs
- ChannelOptions.cs
- FixedTextPointer.cs
- BasicHttpBinding.cs
- CodeDirectoryCompiler.cs
- BaseParaClient.cs
- Int32Rect.cs
- StaticContext.cs
- COAUTHINFO.cs
- ConvertTextFrag.cs
- DesignBinding.cs
- DocumentScope.cs
- Attachment.cs
- DataGridViewLayoutData.cs
- SafeNativeMethods.cs
- TimeSpanSecondsConverter.cs
- InstanceHandleConflictException.cs
- GenericArgumentsUpdater.cs
- Button.cs
- StrokeCollectionDefaultValueFactory.cs
- WebPartZoneBaseDesigner.cs
- TaskHelper.cs
- GridViewRowCollection.cs
- XmlDataImplementation.cs
- TaskHelper.cs
- ReferenceService.cs
- UIElement.cs
- OracleParameterBinding.cs
- BigInt.cs
- GuidelineCollection.cs
- RawTextInputReport.cs
- MissingSatelliteAssemblyException.cs
- EndPoint.cs
- URIFormatException.cs
- GetMemberBinder.cs
- StringCollectionMarkupSerializer.cs
- X509UI.cs
- RoleBoolean.cs
- XmlObjectSerializerReadContextComplexJson.cs
- handlecollector.cs
- SqlWebEventProvider.cs
- XD.cs
- DateTimeOffsetConverter.cs
- safelinkcollection.cs
- Timer.cs
- StrokeIntersection.cs
- PagerStyle.cs
- Operand.cs
- ResourcesBuildProvider.cs
- CustomErrorsSectionWrapper.cs
- CompositeScriptReference.cs
- DynamicQueryableWrapper.cs
- WebSysDefaultValueAttribute.cs
- XmlSchemaCollection.cs
- NumberFormatInfo.cs
- EventTrigger.cs
- FileCodeGroup.cs
- BitmapInitialize.cs
- Viewport3DVisual.cs
- XmlBuffer.cs
- StandardTransformFactory.cs
- QueryRewriter.cs
- WebPartConnectionsEventArgs.cs
- ImageCollectionCodeDomSerializer.cs
- DynamicMethod.cs
- SspiSecurityTokenProvider.cs