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
- Permission.cs
- QilList.cs
- HijriCalendar.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- CompilerCollection.cs
- ObjectSpanRewriter.cs
- SafeEventLogWriteHandle.cs
- KeyValuePair.cs
- Vector3DAnimationBase.cs
- ButtonBase.cs
- BaseTemplateParser.cs
- PrincipalPermission.cs
- XmlTypeMapping.cs
- SkipQueryOptionExpression.cs
- StreamReader.cs
- JournalEntryListConverter.cs
- ScriptReferenceEventArgs.cs
- FrameworkContentElementAutomationPeer.cs
- ConnectionPoolManager.cs
- SessionStateContainer.cs
- LinkTarget.cs
- HttpAsyncResult.cs
- ClientType.cs
- MetadataItemEmitter.cs
- FixedSOMElement.cs
- Tablet.cs
- LockCookie.cs
- DiscoveryVersionConverter.cs
- ObjectItemAssemblyLoader.cs
- DbConvert.cs
- CodeNamespaceImport.cs
- FormsAuthenticationCredentials.cs
- UnitySerializationHolder.cs
- GenericWebPart.cs
- PopupEventArgs.cs
- HtmlGenericControl.cs
- RequiredFieldValidator.cs
- FormViewPageEventArgs.cs
- SurrogateEncoder.cs
- OleDbDataAdapter.cs
- InternalException.cs
- SimpleHandlerBuildProvider.cs
- CompiledQuery.cs
- WebHttpSecurityModeHelper.cs
- FilterFactory.cs
- MarkupCompilePass1.cs
- WsiProfilesElement.cs
- Pair.cs
- ScaleTransform3D.cs
- TickBar.cs
- TextReader.cs
- CreateUserWizardStep.cs
- PrintController.cs
- SourceLineInfo.cs
- XPathConvert.cs
- TemplateXamlParser.cs
- EntitySqlQueryState.cs
- StringPropertyBuilder.cs
- ImageMap.cs
- OledbConnectionStringbuilder.cs
- CryptoKeySecurity.cs
- BrushMappingModeValidation.cs
- RealProxy.cs
- ControlTemplate.cs
- NativeCompoundFileAPIs.cs
- TransformGroup.cs
- SemanticResolver.cs
- NativeMethods.cs
- AudioSignalProblemOccurredEventArgs.cs
- SafeNativeMethodsCLR.cs
- WaitHandle.cs
- SafeRightsManagementQueryHandle.cs
- ReadingWritingEntityEventArgs.cs
- CodeEntryPointMethod.cs
- NestedContainer.cs
- CountdownEvent.cs
- PieceNameHelper.cs
- SqlSelectClauseBuilder.cs
- SqlTypesSchemaImporter.cs
- ResXResourceReader.cs
- SqlDataSourceQueryEditorForm.cs
- FileUtil.cs
- ClusterRegistryConfigurationProvider.cs
- DropShadowBitmapEffect.cs
- XmlCodeExporter.cs
- HtmlShimManager.cs
- SrgsSubset.cs
- TaskForm.cs
- cookieexception.cs
- CompilerHelpers.cs
- CallbackValidatorAttribute.cs
- RootContext.cs
- ProviderUtil.cs
- CapabilitiesAssignment.cs
- BooleanConverter.cs
- ExtensionQuery.cs
- ArgumentsParser.cs
- XmlAnyElementAttribute.cs
- Drawing.cs
- SingleAnimationBase.cs