Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / WebBrowserUriTypeConverter.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlNavigatorFilter.cs
- ACE.cs
- KeyValuePair.cs
- UIServiceHelper.cs
- PolicyValidationException.cs
- SelectedDatesCollection.cs
- NameTable.cs
- FunctionMappingTranslator.cs
- ContainerParagraph.cs
- PassportAuthenticationEventArgs.cs
- Object.cs
- DrawListViewColumnHeaderEventArgs.cs
- TextSelectionHelper.cs
- ProjectionPathSegment.cs
- OptimizedTemplateContent.cs
- ItemContainerPattern.cs
- MessageTransmitTraceRecord.cs
- ConfigXmlAttribute.cs
- CompositeCollectionView.cs
- Identifier.cs
- PathGeometry.cs
- StoreAnnotationsMap.cs
- SafeViewOfFileHandle.cs
- UidManager.cs
- CompModSwitches.cs
- hebrewshape.cs
- DbExpressionRules.cs
- EpmContentSerializerBase.cs
- CellQuery.cs
- FontDifferentiator.cs
- Adorner.cs
- TableCell.cs
- AutomationEvent.cs
- BindingMemberInfo.cs
- UdpDiscoveryEndpoint.cs
- DiagnosticStrings.cs
- DefaultProxySection.cs
- EllipseGeometry.cs
- ParseElement.cs
- SqlConnectionPoolProviderInfo.cs
- XPathNavigatorReader.cs
- Hash.cs
- ParserStreamGeometryContext.cs
- BitmapEffectDrawingContextWalker.cs
- InputBuffer.cs
- TextEffectCollection.cs
- ConnectionManagementSection.cs
- While.cs
- SimplePropertyEntry.cs
- TemporaryBitmapFile.cs
- CroppedBitmap.cs
- RoutedCommand.cs
- SoapElementAttribute.cs
- DataRowView.cs
- Geometry.cs
- MailDefinition.cs
- NativeMethods.cs
- ConstraintEnumerator.cs
- InfoCardBaseException.cs
- CodeParameterDeclarationExpression.cs
- FixUp.cs
- httpserverutility.cs
- XPathBinder.cs
- CreateRefExpr.cs
- ExpressionStringBuilder.cs
- SafeFileHandle.cs
- TextStore.cs
- WebServiceErrorEvent.cs
- GPRECT.cs
- DbConnectionFactory.cs
- DBSqlParserColumn.cs
- TabControl.cs
- LayoutInformation.cs
- SQLDouble.cs
- CurrentChangingEventArgs.cs
- Internal.cs
- EmbeddedMailObject.cs
- MouseGestureValueSerializer.cs
- Wildcard.cs
- SoapHeaderAttribute.cs
- ProjectedSlot.cs
- Transform.cs
- DispatcherFrame.cs
- AssemblyBuilder.cs
- HttpDictionary.cs
- HtmlForm.cs
- TrackingMemoryStreamFactory.cs
- ToolStripItemRenderEventArgs.cs
- XmlSerializerFactory.cs
- InvalidOleVariantTypeException.cs
- AQNBuilder.cs
- RequestCache.cs
- PenContexts.cs
- UniqueEventHelper.cs
- BindToObject.cs
- PolyBezierSegment.cs
- StringComparer.cs
- CharacterString.cs
- BuildProviderCollection.cs
- DocumentViewerBaseAutomationPeer.cs