File.OpenText method is not declared error
Posted
by Nandini
on Stack Overflow
See other posts from Stack Overflow
or by Nandini
Published on 2010-03-25T09:12:52Z
Indexed on
2010/03/25
9:23 UTC
Read the original article
Hit count: 307
ASP.NET
Hi, i have a fileupload control from which i need the path of a text file. After selecting the file,i need to open the file for reading the data from the text file.For this, i used the following code to open the text file.
fp=File.OpenText(FileUpload2.PostedFile.FileName)
This is working fine in my system.The FileUpload2.PostedFile.FileName statement gives the path of the file.The File.OpenText method opens the selected file.But when i run my project in IIS,it gives the following error:
"File.OpenText is not declared."
The FileUpload2.PostedFile.FileName statement is not retrieving the path, it retrieves only only the filename.what could be the reason?
© Stack Overflow or respective owner