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
- MsmqChannelFactoryBase.cs
- SchemaCollectionCompiler.cs
- SymLanguageVendor.cs
- SimpleExpression.cs
- TileModeValidation.cs
- UnmanagedMarshal.cs
- AuthenticationModulesSection.cs
- UnaryExpression.cs
- TemplatePagerField.cs
- Signature.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- MultipartIdentifier.cs
- BlurEffect.cs
- DebugManager.cs
- CodeTypeMemberCollection.cs
- Console.cs
- WindowsListViewScroll.cs
- ColumnCollection.cs
- SqlConnection.cs
- BoolExpr.cs
- CryptoStream.cs
- BufferAllocator.cs
- ResourceDefaultValueAttribute.cs
- ConfigurationSectionCollection.cs
- shaperfactoryquerycacheentry.cs
- HtmlTernaryTree.cs
- RowCache.cs
- ResourceDictionary.cs
- InvokeAction.cs
- WindowsBrush.cs
- ButtonField.cs
- _UncName.cs
- PartitionedDataSource.cs
- TreeViewCancelEvent.cs
- XmlSigningNodeWriter.cs
- ManipulationInertiaStartingEventArgs.cs
- ApplicationSecurityManager.cs
- Baml6ConstructorInfo.cs
- ImageIndexConverter.cs
- BaseResourcesBuildProvider.cs
- VectorCollectionConverter.cs
- FacetDescriptionElement.cs
- PerformanceCounter.cs
- ServicePointManager.cs
- GroupBoxRenderer.cs
- Material.cs
- Activity.cs
- IisTraceListener.cs
- LayoutEditorPart.cs
- EntityClientCacheKey.cs
- RecordManager.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- DataServices.cs
- IList.cs
- NativeMethods.cs
- PathTooLongException.cs
- ManagedFilter.cs
- CursorConverter.cs
- ProfileService.cs
- SqlEnums.cs
- SignedXml.cs
- Cell.cs
- Label.cs
- ObjectCacheSettings.cs
- Helpers.cs
- WorkflowRuntime.cs
- CodeDirectoryCompiler.cs
- MethodRental.cs
- ZipIOExtraField.cs
- BindingNavigatorDesigner.cs
- SelectionEditor.cs
- ZoneButton.cs
- StateItem.cs
- SyndicationDeserializer.cs
- ReadOnlyNameValueCollection.cs
- VectorValueSerializer.cs
- XmlSerializationReader.cs
- DetectRunnableInstancesTask.cs
- HWStack.cs
- RegexCharClass.cs
- PriorityBinding.cs
- TemplateXamlParser.cs
- SafeCryptHandles.cs
- XXXInfos.cs
- SHA256Managed.cs
- BaseComponentEditor.cs
- Button.cs
- Stream.cs
- CustomErrorsSection.cs
- FamilyMap.cs
- StateBag.cs
- CompModSwitches.cs
- ViewStateModeByIdAttribute.cs
- EndpointAddressMessageFilter.cs
- HtmlLinkAdapter.cs
- ProxySimple.cs
- complextypematerializer.cs
- WindowCollection.cs
- MetadataException.cs
- ScriptComponentDescriptor.cs