Error: URI formats are not supported

Discussion in 'ASP .Net' started by VB Programmer, May 14, 2005.

  1. On this line of code:
    objStreamReader = File.OpenText(FILENAME)

    I get this error:
    URI formats are not supported.
    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.

    Exception Details: System.ArgumentException: URI formats are not supported.

    Source Error:
    Line 40: 'Get a StreamReader class that can be used to read the file
    Line 41: Dim objStreamReader As StreamReader
    Line 42: objStreamReader = File.OpenText(FILENAME)
    Line 43:
    Line 44: 'Now, read the entire file into a string

    Source File: c:\inetpub\wwwroot\MyWeb\Secured\MemberNewsletter.aspx.vb
    Line: 42

    Stack Trace:
    [ArgumentException: URI formats are not supported.]
    System.IO.Path.GetFullPathInternal(String path) +270
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
    bFromProxy) +233
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize) +44
    System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
    detectEncodingFromByteOrderMarks, Int32 bufferSize) +79
    System.IO.StreamReader..ctor(String path) +101
    System.IO.File.OpenText(String path) +30
    AAPPEX.MemberNewsletter.Page_Load(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\AAPPEX\Secured\MemberNewsletter.aspx.vb:42
    System.Web.UI.Control.OnLoad(EventArgs e)
    System.Web.UI.Control.LoadRecursive()
    System.Web.UI.Page.ProcessRequestMain()
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
    Version:1.1.4322.2032

    Any ideas?

    Thanks.
     
    VB Programmer, May 14, 2005
    #1
    1. Advertising

  2. NM. The path had "file:" in front of it. Dumb me!

    "VB Programmer" <> wrote in message
    news:...
    > On this line of code:
    > objStreamReader = File.OpenText(FILENAME)
    >
    > I get this error:
    > URI formats are not supported.
    > 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.
    >
    > Exception Details: System.ArgumentException: URI formats are not
    > supported.
    >
    > Source Error:
    > Line 40: 'Get a StreamReader class that can be used to read the
    > file
    > Line 41: Dim objStreamReader As StreamReader
    > Line 42: objStreamReader = File.OpenText(FILENAME)
    > Line 43:
    > Line 44: 'Now, read the entire file into a string
    >
    > Source File: c:\inetpub\wwwroot\MyWeb\Secured\MemberNewsletter.aspx.vb
    > Line: 42
    >
    > Stack Trace:
    > [ArgumentException: URI formats are not supported.]
    > System.IO.Path.GetFullPathInternal(String path) +270
    > System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
    > access, FileShare share, Int32 bufferSize, Boolean useAsync, String
    > msgPath, Boolean bFromProxy) +233
    > System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
    > access, FileShare share, Int32 bufferSize) +44
    > System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
    > detectEncodingFromByteOrderMarks, Int32 bufferSize) +79
    > System.IO.StreamReader..ctor(String path) +101
    > System.IO.File.OpenText(String path) +30
    > AAPPEX.MemberNewsletter.Page_Load(Object sender, EventArgs e) in
    > c:\inetpub\wwwroot\AAPPEX\Secured\MemberNewsletter.aspx.vb:42
    > System.Web.UI.Control.OnLoad(EventArgs e)
    > System.Web.UI.Control.LoadRecursive()
    > System.Web.UI.Page.ProcessRequestMain()
    > --------------------------------------------------------------------------------
    > Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
    > ASP.NET Version:1.1.4322.2032
    >
    > Any ideas?
    >
    > Thanks.
    >
     
    VB Programmer, May 14, 2005
    #2
    1. Advertising

  3. VB Programmer

    dirkasaurus-rex

    Joined:
    Oct 11, 2006
    Messages:
    1
    URI format not supported - solved

    I too encountered this problem. It came down to having "File:\" as the prefix on the file path. This was generated by the following line of code:

    sInXMLFile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) & "\XYZ.xml"

    I trapped for this prefix and stripped it off allowing the application to execute correctly.

    Hope this helps someone out there!

    Dirkasaurus-rex
     
    dirkasaurus-rex, Oct 11, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,391
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,482
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,662
    Peter Flynn
    Aug 4, 2004
  4. etheriau
    Replies:
    1
    Views:
    673
    Pavel
    Aug 23, 2004
  5. Mel
    Replies:
    2
    Views:
    802
Loading...

Share This Page