You must Sign In to post a response.
  • Category: Complaints

    Hosting text file in aspspider

    i have hosted .txt file what will be the path of the file?how i can access this file in other pages.
  • #6997
    Hello areeb
    If you mean access from the code page it is possible so:

    StreamReader sr = new StreamReader(Server.MapPath(".") + "your_file_name.txt"));

    try {
    sr.ReadLine();
    and etc...

    It's example if your txt -file placed in webroot directory.

    if the file is in a subfolder then this code:
    If the file is in a subfolder then this code must be inserted in the constructor StreamReader():

    Server.MapPath(".") +@"\your_subfolder_name\"+ "your_file_name.txt"

    Best regards!


  • Sign In to post your comments