Reading A Text File From A Remote Server

Discussion in 'ASP .Net' started by Trevor, Jun 5, 2005.

  1. Trevor

    Trevor Guest

    I posted this message last week but seem to be missing a few days posts.

    We currently run our web site in php and are now converting it to asp.net to
    match the rest of our business that is .net based. I have tried using the
    following code layout to open the file I require but get an illigal
    character exception when I try and open the file.

    Dim sFileName As String =
    "https://www.breathecall.com/wholesale/api/api.php?partnerid=9aa999aa99999999aa99aaaa99a9a9aa&wid=99990&action=0&account=99999"
    Dim oFileStream As New IO.FileStream(sFileName, IO.FileMode.Open)
    Dim oDataFile As New IO.StreamReader(oFileStream)

    The file name works fine when in php. Are there specific characters that
    cannot be used in a path name within the dotnet framework? If so is there a
    way to get round the problem?

    Thanks in advance
     
    Trevor, Jun 5, 2005
    #1
    1. Advertising

  2. Hi Trevor,

    Yes, I did have found your former thread in the newsgroup and replied in
    that one, since you've missed that one, here is the google link of it:

    http://groups-beta.google.com/group/microsoft.public.dotnet.framework.aspnet
    /browse_thread/thread/d74c2dbfc1b1a126/d2dc11ef1d402fd0?q=%22Reading+A+Text+
    File+From+A+Remote+Server%22&rnum=2&hl=en#d2dc11ef1d402fd0

    Also, for your convenience, I've repasted my former response here, if there
    are still anything unclear or need help, please feel free to post here.

    =========================
    Welcome to ASPNET newsgroup.
    As for the Reading text file from remote server problem you mentiond, here
    are some of my understanding and suggestinos:


    The System.IO namespace's classes are target for local file storage for
    remote fileshared (UNC) in the same intranet. For internet based
    scenario(such as http url path), we should use the classes under System.Net
    namespace to retrieve them. The System.Net.HttpWebRequest and
    System.Web.WebClient classes are two useful one. And the WebClient is
    especically useful and simplified, we can use it's DownloadData,
    DownLoadFile to retreive file/stream from remote webserver. Here are some
    tech articles and resources describing using webclient or webrequest:


    #WebClient Class #HttpWebRequest Class
    http://msdn.microsoft.com/libr-ary/en-us/cpref/html/frlrfsyst-emnetwebc...
    http://msdn.microsoft.com/libr-ary/en-us/cpref/html/frlrfSyst-emNetHttp...


    #Using WebRequest and WebResponse classes
    http://www.c-sharpcorner.com/I-nternet/WebRequestNResponseMDB-.asp


    Hope helps. Thanks,


    Steven Cheng
    Microsoft Online Support
    ===========================================

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Jun 6, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darrel
    Replies:
    3
    Views:
    695
    Kevin Spencer
    Nov 11, 2004
  2. Trevor
    Replies:
    1
    Views:
    657
    Steven Cheng[MSFT]
    May 30, 2005
  3. Dayton Jones

    Remote.pm (File::Remote) problem

    Dayton Jones, Mar 1, 2006, in forum: Perl Misc
    Replies:
    9
    Views:
    212
    Dayton Jones
    Mar 3, 2006
  4. kath

    problem reading remote file.

    kath, Feb 16, 2007, in forum: Perl Misc
    Replies:
    6
    Views:
    183
    Joe Smith
    Feb 18, 2007
  5. Adrian

    Reading a remote file or page?

    Adrian, Jan 17, 2006, in forum: Javascript
    Replies:
    2
    Views:
    98
    Adrian
    Jan 17, 2006
Loading...

Share This Page