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
- GridItemProviderWrapper.cs
- ThicknessAnimation.cs
- TextSelection.cs
- ColorTransformHelper.cs
- FrameworkContentElementAutomationPeer.cs
- EndOfStreamException.cs
- LayoutTable.cs
- CultureTableRecord.cs
- WebPartCloseVerb.cs
- OleDbParameter.cs
- _ListenerResponseStream.cs
- CapabilitiesUse.cs
- Symbol.cs
- StylusDevice.cs
- ExpandSegment.cs
- ComEventsHelper.cs
- EntityDataSourceChangingEventArgs.cs
- BindableAttribute.cs
- XmlAttribute.cs
- DbProviderFactories.cs
- SqlRemoveConstantOrderBy.cs
- peernodeimplementation.cs
- GuidelineSet.cs
- SmtpLoginAuthenticationModule.cs
- CheckBoxList.cs
- CompilationUtil.cs
- OleDbPropertySetGuid.cs
- SerialErrors.cs
- EntityDataReader.cs
- OleAutBinder.cs
- FixedNode.cs
- ReceiveDesigner.xaml.cs
- StorageEntityContainerMapping.cs
- ArgumentNullException.cs
- AssemblyCacheEntry.cs
- GridViewRow.cs
- XPathAncestorQuery.cs
- StringReader.cs
- EntityCommand.cs
- PresentationSource.cs
- EntityDataSourceConfigureObjectContext.cs
- CodeObject.cs
- DesignerActionPanel.cs
- DataGridViewCellLinkedList.cs
- SQLString.cs
- DbProviderManifest.cs
- IdentityManager.cs
- SqlDataSource.cs
- DesignerAttributeInfo.cs
- PropertyItem.cs
- Models.cs
- OutputScopeManager.cs
- ColorMap.cs
- Parser.cs
- CodeSnippetCompileUnit.cs
- ObjectViewFactory.cs
- ServiceModelTimeSpanValidator.cs
- XmlSchemaSimpleTypeList.cs
- OutKeywords.cs
- CqlParser.cs
- MetaModel.cs
- InputLanguageSource.cs
- UIElement3D.cs
- TypeSemantics.cs
- DesignerVerbToolStripMenuItem.cs
- TextTreeInsertElementUndoUnit.cs
- CharKeyFrameCollection.cs
- ToggleProviderWrapper.cs
- UInt64Converter.cs
- ResourceAttributes.cs
- TextEditorThreadLocalStore.cs
- SafeNativeMemoryHandle.cs
- SpellerInterop.cs
- DataGridColumnHeadersPresenter.cs
- PageFunction.cs
- SynchronizationLockException.cs
- XmlNodeList.cs
- PointHitTestResult.cs
- AttributeProviderAttribute.cs
- EncoderExceptionFallback.cs
- FileDialogCustomPlacesCollection.cs
- CheckBoxField.cs
- WindowHideOrCloseTracker.cs
- ACL.cs
- AccessViolationException.cs
- autovalidator.cs
- ElapsedEventArgs.cs
- AnimationClock.cs
- DelegateSerializationHolder.cs
- SqlInternalConnection.cs
- MaskedTextBox.cs
- ExtractedStateEntry.cs
- CheckableControlBaseAdapter.cs
- LockCookie.cs
- ToolStripItemRenderEventArgs.cs
- BufferModesCollection.cs
- XmlBoundElement.cs
- XmlCustomFormatter.cs
- DataGridItemCollection.cs
- ModelToObjectValueConverter.cs