Ask a Question related to ASP.NET Web Services, Design and Development.
-
TC #1
Error: Could not find a part of the path / Reading and Writing to files in ASP.Net
Hello,
I'm trying to read a text file located in the top folder of the virtual
directory and I'm receiving the following error:
"Could not find a part of the path"
Below is the code that I'm using:
string MyFile;
MyFile =Request.ApplicationPath + "//sample1.txt";
StreamReader srReader;
srReader = new StreamReader(MyFile);
txtMessage.Text = srReader.ReadLine();
I have tried both "Windows" and "None" for "Authentication mode".
Any ideas?
Thanks & Regards,
TC
TC Guest
-
"Could not find a part of the path… " error on IIS 6.0
I have an ASP.NET web application running on a load-balanced Windows Server 2003 web farm running IIS 6.0, using Active Directory authentication. ... -
Reading from / Writing to text files out of Flash
Does anyone know a Flash sample which reads and/or writes something to/from a text file? I read somewhere that this is possible in general but never... -
reading and writing files to local drives
Hi, I've been looking into creating an app that reads an xml file and then saves it again to the local drive. Now I've tried the MMSave... -
Reading and writing files in PHP
"Marc" <meelzooi2000@yahoo.com> wrote in message news:acad69df.0309010758.2de3fef5@posting.google.com... processing the file (not having written... -
Reading writing to INI files
Hello, Are there any modules available that can read/write to INI files. Thanks in advance Saadat Saeed ... -
TC #2
Error: Could not find a part of the path / Reading and Writing to files in ASP.Net
Hello,
I'm trying to read a text file located in the top folder of the virtual
directory and I'm receiving the following error:
"Could not find a part of the path"
Below is the code that I'm using:
string MyFile;
MyFile =Request.ApplicationPath + "//sample1.txt";
StreamReader srReader;
srReader = new StreamReader(MyFile);
txtMessage.Text = srReader.ReadLine();
I have tried both "Windows" and "None" for "Authentication mode".
Any ideas?
Thanks & Regards,
TC
TC Guest
-
[MSFT] #3
RE: Error: Could not find a part of the path / Reading and Writing to files in ASP.Net
Hello,
Request.ApplicationPath will return a virtual path string like
"/WebApplication1". However, StreamReader require a physical path like
"C:\inetpub\webapplication1\sample.txt". To convert a virtual path to
physical path, we can use MapPath method:
MyFile =Server.MapPath(Request.ApplicationPath + "//sample1.txt");
Hope this help,
Luke
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
[MSFT] Guest
-
[MSFT] #4
RE: Error: Could not find a part of the path / Reading and Writing to files in ASP.Net
Hello,
Request.ApplicationPath will return a virtual path string like
"/WebApplication1". However, StreamReader require a physical path like
"C:\inetpub\webapplication1\sample.txt". To convert a virtual path to
physical path, we can use MapPath method:
MyFile =Server.MapPath(Request.ApplicationPath + "//sample1.txt");
Hope this help,
Luke
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
[MSFT] Guest



Reply With Quote

