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
- BoundsDrawingContextWalker.cs
- GridPattern.cs
- HandleExceptionArgs.cs
- FileDetails.cs
- ArrayItemValue.cs
- StringCollectionMarkupSerializer.cs
- CommandField.cs
- ScopelessEnumAttribute.cs
- TreeViewItem.cs
- NavigationPropertyEmitter.cs
- CookieParameter.cs
- PageBuildProvider.cs
- GenericUriParser.cs
- Types.cs
- ForeignConstraint.cs
- MtomMessageEncodingBindingElement.cs
- ListControl.cs
- ConfigurationSection.cs
- SplitterPanel.cs
- WebRequestModuleElementCollection.cs
- QueryResponse.cs
- WindowsScrollBar.cs
- columnmapfactory.cs
- Item.cs
- ToolStripGripRenderEventArgs.cs
- SafeFindHandle.cs
- UnaryQueryOperator.cs
- TextBlockAutomationPeer.cs
- LayoutTableCell.cs
- PropertyGrid.cs
- HtmlButton.cs
- VisualTarget.cs
- WindowsFormsDesignerOptionService.cs
- SafeUserTokenHandle.cs
- Window.cs
- PathFigureCollection.cs
- VectorCollection.cs
- UnhandledExceptionEventArgs.cs
- ActiveXHelper.cs
- XPathItem.cs
- ContextMenu.cs
- DataGridViewCellStateChangedEventArgs.cs
- KeyedQueue.cs
- UpdatePanelControlTrigger.cs
- InArgumentConverter.cs
- XamlPathDataSerializer.cs
- DelegateOutArgument.cs
- XmlSchemaSequence.cs
- TextDecorations.cs
- PermissionRequestEvidence.cs
- WS2007FederationHttpBindingElement.cs
- ToolbarAUtomationPeer.cs
- SafeNativeMethods.cs
- ProxyWebPart.cs
- SQLDateTimeStorage.cs
- AsyncOperation.cs
- WorkflowMessageEventArgs.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- ElasticEase.cs
- LinkUtilities.cs
- BuilderPropertyEntry.cs
- BitmapEditor.cs
- StackOverflowException.cs
- ToolStripDesigner.cs
- ToolStripScrollButton.cs
- TemplatedAdorner.cs
- ActivityBuilderHelper.cs
- XmlSchemaCompilationSettings.cs
- TextReader.cs
- SafeRegistryKey.cs
- RadioButtonList.cs
- SiteMapHierarchicalDataSourceView.cs
- IssuanceLicense.cs
- OrderedDictionaryStateHelper.cs
- KnownTypesHelper.cs
- AuthenticationModulesSection.cs
- EventListenerClientSide.cs
- MenuAutomationPeer.cs
- PanelDesigner.cs
- ExceptionHandlerDesigner.cs
- BinarySecretSecurityToken.cs
- Mouse.cs
- StatusBarPanelClickEvent.cs
- SettingsPropertyNotFoundException.cs
- XhtmlBasicPanelAdapter.cs
- StreamWithDictionary.cs
- EntityProviderServices.cs
- PropertyConverter.cs
- XmlSerializerNamespaces.cs
- ListViewGroupItemCollection.cs
- SettingsProviderCollection.cs
- ItemCollectionEditor.cs
- AudioFileOut.cs
- ResourceManager.cs
- StrokeNodeEnumerator.cs
- IntSecurity.cs
- DateTimeConverter.cs
- KeySpline.cs
- SiteMapPath.cs
- X509Utils.cs