Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / WebBrowserUriTypeConverter.cs / 1 / WebBrowserUriTypeConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.ComponentModel; namespace System.Windows.Forms { class WebBrowserUriTypeConverter : UriTypeConverter { public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { //The UriTypeConverter gives back a relative Uri for things like "www.microsoft.com". If //the Uri is relative, we'll try sticking "http://" on the front to see whether that fixes it up. Uri uri = base.ConvertFrom(context, culture, value) as Uri; if (uri != null && !string.IsNullOrEmpty(uri.OriginalString) && !uri.IsAbsoluteUri) { try { uri = new Uri("http://" + uri.OriginalString.Trim()); } catch (UriFormatException) { //We can't throw "http://" on the front: just return the original (relative) Uri, //which will throw an exception with reasonable text later. } } return uri; } } } // 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
- XmlKeywords.cs
- BehaviorEditorPart.cs
- MenuBindingsEditor.cs
- PreservationFileWriter.cs
- Comparer.cs
- XamlFigureLengthSerializer.cs
- MultiTrigger.cs
- ObjectStateManagerMetadata.cs
- HttpHeaderCollection.cs
- TreeNodeStyle.cs
- SingleAnimationUsingKeyFrames.cs
- NetSectionGroup.cs
- Visual3D.cs
- MailSettingsSection.cs
- SrgsRule.cs
- CacheVirtualItemsEvent.cs
- HwndTarget.cs
- ActivityExecutionContextCollection.cs
- TypeConverterMarkupExtension.cs
- AccessibleObject.cs
- NamespaceListProperty.cs
- ProxyWebPartConnectionCollection.cs
- CheckBoxFlatAdapter.cs
- NavigatorInput.cs
- MdImport.cs
- VectorKeyFrameCollection.cs
- DataKeyCollection.cs
- SignedXml.cs
- PropertyMetadata.cs
- ResourceLoader.cs
- EntityContainer.cs
- XPathDocumentNavigator.cs
- DataExpression.cs
- MinMaxParagraphWidth.cs
- DrawListViewSubItemEventArgs.cs
- ExpressionEditorAttribute.cs
- ConfigXmlAttribute.cs
- ExpressionNormalizer.cs
- MatchingStyle.cs
- InstallHelper.cs
- MsmqBindingFilter.cs
- CacheVirtualItemsEvent.cs
- SqlUtils.cs
- DataTableMappingCollection.cs
- ConditionalAttribute.cs
- XmlSchemaFacet.cs
- ISO2022Encoding.cs
- TextServicesLoader.cs
- UserControlParser.cs
- ExtenderProvidedPropertyAttribute.cs
- TextDecorations.cs
- ZipFileInfoCollection.cs
- KeyNotFoundException.cs
- AxWrapperGen.cs
- TextParagraph.cs
- GeneralTransform3DGroup.cs
- NetCodeGroup.cs
- DashStyle.cs
- HtmlFormWrapper.cs
- SafeArrayRankMismatchException.cs
- IndexedEnumerable.cs
- SubMenuStyle.cs
- StateDesigner.Helpers.cs
- XmlArrayAttribute.cs
- GridViewUpdateEventArgs.cs
- EmptyCollection.cs
- SingletonConnectionReader.cs
- DecoderNLS.cs
- DataSourceCacheDurationConverter.cs
- Expression.cs
- ReadOnlyHierarchicalDataSourceView.cs
- HwndSubclass.cs
- BindableAttribute.cs
- RightsManagementInformation.cs
- BaseAutoFormat.cs
- DocumentOrderQuery.cs
- DbExpressionRules.cs
- EntityModelBuildProvider.cs
- FixedSOMTableRow.cs
- HandlerFactoryWrapper.cs
- SynchronizationScope.cs
- SymbolPair.cs
- configsystem.cs
- XmlLinkedNode.cs
- MatcherBuilder.cs
- AppDomainFactory.cs
- ReflectionTypeLoadException.cs
- GlyphRun.cs
- AssociatedControlConverter.cs
- StructuralCache.cs
- HttpResponseHeader.cs
- Exceptions.cs
- cookie.cs
- DataSetMappper.cs
- ListItemCollection.cs
- SoapAttributes.cs
- ConfigDefinitionUpdates.cs
- ImageListUtils.cs
- LongSumAggregationOperator.cs
- ListMarkerSourceInfo.cs