none
Downloading text file RRS feed

  • Question

  • Hi

    I'm downloading a test file using:

    myWebClient.DownloadFile("http://" + myStringWebResourceVer, updVerFileName);

    The file on the web site only has 1.0.0.1 as its contents.

    Downloading it the text file looks like text from a web page:

    e.g. 

    <html>
    <frameset rows="100%,*" frameborder="NO" border="0" framespacing="0">
    <frame name="1mainforwardframe1" src= etc...

    I read file file using:

    updVersion = File.ReadAllText(updVerFileName);

    but updVersion only contains the html code rather than the original file's content.

    Using the html visualiser I can see the value 1.0.0.1 displayed.

    Can someone please get me out of this problem?

    Thanks


    Ray


    • Edited by RayLS Tuesday, August 7, 2018 10:37 PM
    Tuesday, August 7, 2018 9:10 PM

Answers

  • Note that since there are frames, you should use the address of the particular frame. This address (or relative part) is specified in the src attribute of the corresponding <frame> element. Then show the received contents of the frame, maybe it is a simple text or can be parsed easily.

    • Edited by Viorel_MVP Wednesday, August 8, 2018 5:23 AM
    • Marked as answer by RayLS Friday, August 10, 2018 10:37 AM
    Wednesday, August 8, 2018 5:20 AM
  • A new day and a clear head solved the problem,

    In the text downloaded was the clue as it showed the full plain address of the file.

    I'd changed my web hosting company and hadn't taken the new IP address into account

    Thanks for everyone's contributions as they pointed me to look at the content of the downloaded http info.

    Ray 


    Ray

    Wednesday, August 8, 2018 7:47 AM

All replies

  • Try use HTTP proxy such as Fiddler to view the raw content. Is there only "1.0.0.1" in the content?

    If yes, IMO it's simpler to use WebClient.DownloadString() instead of what you do. In addition to less code need to be written, it also neatly handles charset difference if exists.

    If not, either check the page generate the content (You may want to add a "static file handler" in your web.config for the file type (Note: Use "*.ext" in the "path" attribute instead of just "*" because that SO thread is addressing a different situation, see this for normal syntax of handler add element) in order to avoid extensions in your project meddling the static content before transfer to browser)



    Wednesday, August 8, 2018 2:10 AM
    Answerer
  • Note that since there are frames, you should use the address of the particular frame. This address (or relative part) is specified in the src attribute of the corresponding <frame> element. Then show the received contents of the frame, maybe it is a simple text or can be parsed easily.

    • Edited by Viorel_MVP Wednesday, August 8, 2018 5:23 AM
    • Marked as answer by RayLS Friday, August 10, 2018 10:37 AM
    Wednesday, August 8, 2018 5:20 AM
  • A new day and a clear head solved the problem,

    In the text downloaded was the clue as it showed the full plain address of the file.

    I'd changed my web hosting company and hadn't taken the new IP address into account

    Thanks for everyone's contributions as they pointed me to look at the content of the downloaded http info.

    Ray 


    Ray

    Wednesday, August 8, 2018 7:47 AM
  • Hi RayLS,

    If your question has been solved, please mark the useful reply as answer to close the thread. This will make answer searching easier in the forum and be beneficial to community members.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 10, 2018 7:50 AM
    Moderator