title: System.UriFormatException: Invalid URI: The hostname could not be parsed
body: <p>All of a sudden I'm getting the following error on my website. It doesn't access a database. It's just a simple website using .NET 2.0.</p>
  
  <p>I did recently apply the available windows server 2003 service packs. Could that have changed things? </p>
  
  <p>I should add that the error randomly comes and goes and has been doing so for today and yesterday. I leave it for 5 minutes and the error is gone.</p>
  
  <blockquote>
    <h2>Server Error in '/' Application.</h2>
    
    <p>Invalid URI: The hostname could not be parsed.  Description: An
    unhandled exception occurred during the execution of the current web
    request. Please review the stack trace for more information about the
    error and where it originated in the code.</p>
  </blockquote>
  
  <p>Exception Details: </p>
  
  <blockquote>
    <p>System.UriFormatException: Invalid URI: The hostname could not be
    parsed.</p>
  </blockquote>
  
  <p>Source Error: </p>
  
  <blockquote>
    <p>An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of
    the exception can be identified using the exception stack trace below.</p>
  </blockquote>
  
  <p>Stack Trace: </p>
  
  <blockquote>
    <p>[UriFormatException: Invalid URI: The hostname could not be parsed.]<br>
    System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
    +5367536    System.Uri.CreateUri(Uri baseUri, String relativeUri, Boolean dontEscape) +31    System.Uri..ctor(Uri baseUri, String
    relativeUri) +34    System.Net.HttpWebRequest.CheckResubmit(Exception&amp;
    e) +5300867</p>
    
    <p>[WebException: Cannot handle redirect from HTTP/HTTPS protocols to
    other dissimilar ones.]    System.Net.HttpWebRequest.GetResponse()
    +5314029    System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +69<br>
    System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
    credentials) +3929371    System.Xml.XmlUrlResolver.GetEntity(Uri
    absoluteUri, String role, Type ofObjectToReturn) +54<br>
    System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +74<br>
    System.Threading.CompressedStack.runTryCode(Object userData) +70<br>
    System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
    code, CleanupCode backoutCode, Object userData) +0<br>
    System.Threading.CompressedStack.Run(CompressedStack compressedStack,
    ContextCallback callback, Object state) +108<br>
    System.Xml.XmlTextReaderImpl.OpenUrl() +186<br>
    System.Xml.XmlTextReaderImpl.Read() +208<br>
    System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
    preserveWhitespace) +112    System.Xml.XmlDocument.Load(XmlReader
    reader) +108<br>
    System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument
    document, CacheDependency&amp; dataCacheDependency, CacheDependency&amp;
    transformCacheDependency) +303<br>
    System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +153<br>
    System.Web.UI.WebControls.XmlDataSourceView.ExecuteSelect(DataSourceSelectArguments
    arguments) +29    System.Web.UI.WebControls.BaseDataList.GetData() +39
    System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean
    useDataSource) +264<br>
    System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +55 
    System.Web.UI.WebControls.BaseDataList.DataBind() +75<br>
    System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55<br>
    System.Web.UI.WebControls.BaseDataList.CreateChildControls() +65<br>
    System.Web.UI.Control.EnsureChildControls() +97<br>
    System.Web.UI.Control.PreRenderRecursiveInternal() +53<br>
    System.Web.UI.Control.PreRenderRecursiveInternal() +202<br>
    System.Web.UI.Control.PreRenderRecursiveInternal() +202<br>
    System.Web.UI.Control.PreRenderRecursiveInternal() +202<br>
    System.Web.UI.Control.PreRenderRecursiveInternal() +202<br>
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +4588</p>
  </blockquote>