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
- DispatcherProcessingDisabled.cs
- ArglessEventHandlerProxy.cs
- DataSourceHelper.cs
- ListBoxAutomationPeer.cs
- SystemParameters.cs
- SymbolMethod.cs
- ZipFileInfoCollection.cs
- SchemaNames.cs
- EndpointAddress.cs
- WebPartMinimizeVerb.cs
- IteratorFilter.cs
- WindowsRichEditRange.cs
- OdbcConnectionOpen.cs
- SqlLiftIndependentRowExpressions.cs
- MachineKeyValidationConverter.cs
- SqlNamer.cs
- PrintDialog.cs
- PkcsUtils.cs
- ConnectorDragDropGlyph.cs
- GridLength.cs
- Focus.cs
- HttpDictionary.cs
- FormView.cs
- XmlSchemaAll.cs
- DataBoundControl.cs
- CaretElement.cs
- BindValidator.cs
- ApplyImportsAction.cs
- DynamicResourceExtensionConverter.cs
- UnmanagedBitmapWrapper.cs
- RecommendedAsConfigurableAttribute.cs
- SqlDataReaderSmi.cs
- TextTreeExtractElementUndoUnit.cs
- TemplateDefinition.cs
- PreservationFileWriter.cs
- DelimitedListTraceListener.cs
- CfgRule.cs
- SqlDataSourceCommandEventArgs.cs
- MappingException.cs
- DataServiceExpressionVisitor.cs
- ExpressionBuilder.cs
- KnownTypeDataContractResolver.cs
- DataContractSerializer.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- StickyNote.cs
- AssignDesigner.xaml.cs
- RequestCache.cs
- SecurityContextSecurityTokenAuthenticator.cs
- Pkcs7Signer.cs
- AssemblyUtil.cs
- XamlReaderHelper.cs
- PropertyInfoSet.cs
- PolyBezierSegmentFigureLogic.cs
- SerializationObjectManager.cs
- Blend.cs
- CachedBitmap.cs
- FormViewDeletedEventArgs.cs
- SqlNodeAnnotations.cs
- TextSpanModifier.cs
- GetLedgerRequest.cs
- BindingSource.cs
- ParameterDataSourceExpression.cs
- RequiredArgumentAttribute.cs
- DispatchWrapper.cs
- NonSerializedAttribute.cs
- SqlUtil.cs
- UIAgentInitializationException.cs
- ImageAutomationPeer.cs
- ColorAnimationUsingKeyFrames.cs
- WpfSharedXamlSchemaContext.cs
- ClientSettingsProvider.cs
- SignatureHelper.cs
- RuntimeWrappedException.cs
- ListSortDescriptionCollection.cs
- Codec.cs
- JoinElimination.cs
- XmlSchemaProviderAttribute.cs
- Int64KeyFrameCollection.cs
- DescendantBaseQuery.cs
- SchemaImporter.cs
- Descriptor.cs
- X509RecipientCertificateClientElement.cs
- CodeRemoveEventStatement.cs
- GeometryModel3D.cs
- WinEventWrap.cs
- RunClient.cs
- TransformedBitmap.cs
- SchemaImporterExtension.cs
- TraversalRequest.cs
- RuntimeConfigurationRecord.cs
- wmiprovider.cs
- MetabaseServerConfig.cs
- WindowsGraphicsCacheManager.cs
- SrgsElementList.cs
- TransactionScope.cs
- PanelStyle.cs
- TypeCacheManager.cs
- ZipIOLocalFileBlock.cs
- XamlFilter.cs
- ResourceAssociationTypeEnd.cs