Error: URI formats are not supported

V

VB Programmer

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.
 
Joined
Oct 11, 2006
Messages
1
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top