Code:
/ DotNET / DotNET / 8.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
- SmtpMail.cs
- PeerNameResolver.cs
- Vector3DAnimation.cs
- AccessorTable.cs
- Matrix.cs
- HttpHandlersInstallComponent.cs
- TraceContextEventArgs.cs
- XslAstAnalyzer.cs
- ConnectionConsumerAttribute.cs
- LicenseManager.cs
- WebPartHelpVerb.cs
- ContractMapping.cs
- InputMethodStateTypeInfo.cs
- TextElementEditingBehaviorAttribute.cs
- MatrixStack.cs
- HostnameComparisonMode.cs
- ConnectionStringsExpressionBuilder.cs
- RecognizedWordUnit.cs
- ToolBarButton.cs
- WorkflowMessageEventHandler.cs
- TimelineClockCollection.cs
- TableLayoutPanel.cs
- GeometryDrawing.cs
- MembershipValidatePasswordEventArgs.cs
- ScrollableControl.cs
- ConstructorBuilder.cs
- WebColorConverter.cs
- ServicePointManager.cs
- OutputBuffer.cs
- StringAnimationUsingKeyFrames.cs
- ConfigXmlWhitespace.cs
- PeerInputChannel.cs
- FlowLayoutPanel.cs
- SqlNotificationRequest.cs
- GraphicsState.cs
- DataQuery.cs
- ItemsControlAutomationPeer.cs
- ItemsControlAutomationPeer.cs
- XmlDocumentFragment.cs
- HashUtility.cs
- CultureData.cs
- ButtonColumn.cs
- CodeDirectionExpression.cs
- MimeWriter.cs
- HighlightComponent.cs
- Int16AnimationUsingKeyFrames.cs
- RsaSecurityKey.cs
- PlacementWorkspace.cs
- OrthographicCamera.cs
- SqlOuterApplyReducer.cs
- ArrayWithOffset.cs
- WebMessageFormatHelper.cs
- GroupDescription.cs
- EmptyEnumerator.cs
- ResolveResponseInfo.cs
- KnownBoxes.cs
- PropertyChangeTracker.cs
- DoubleStorage.cs
- AxParameterData.cs
- ClientUrlResolverWrapper.cs
- DesignerMetadata.cs
- BasicViewGenerator.cs
- BindingListCollectionView.cs
- Image.cs
- StorageEndPropertyMapping.cs
- BaseCodeDomTreeGenerator.cs
- SiteMapPathDesigner.cs
- Deflater.cs
- HtmlWindow.cs
- BaseHashHelper.cs
- Rect3D.cs
- ReaderWriterLockWrapper.cs
- InkSerializer.cs
- CheckBoxPopupAdapter.cs
- HtmlTitle.cs
- WebPartEditorCancelVerb.cs
- DataGridViewCellValidatingEventArgs.cs
- securitymgrsite.cs
- TransformCollection.cs
- DataObject.cs
- IndexedGlyphRun.cs
- HwndSource.cs
- EdmFunction.cs
- XomlDesignerLoader.cs
- EmissiveMaterial.cs
- _DomainName.cs
- XamlToRtfParser.cs
- DesignerProperties.cs
- WindowsSlider.cs
- SqlDataSourceParameterParser.cs
- SegmentInfo.cs
- CultureInfoConverter.cs
- CodeAttachEventStatement.cs
- SafeHandles.cs
- WinFormsComponentEditor.cs
- FixedSchema.cs
- ResourcePermissionBaseEntry.cs
- DataBindingHandlerAttribute.cs
- ChannelPoolSettingsElement.cs
- HitTestDrawingContextWalker.cs