C#-APP: Problems with StreamWriter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Deviant
    New Member
    • Jun 2007
    • 2

    C#-APP: Problems with StreamWriter

    Hello,

    I have a script that already outputs a file in the correct format how I desire but I have run into a problem after I tried advancing the code.

    I am building a web application, via php, that will operate off of scripts generated from this method but the problem occurs once I change the export path from a local string to a web string.

    In other words, I don't want to write to "C:/some folder" but "myurl.com/some folder"

    The domain itself is on a remote server. Also, this will be a widely used application therefore it needs to be applicable to a fully functional shared hosting plan.

    The line itself reads as,
    Code:
    using ( StreamWriter op = new StreamWriter( "SomePath" ) )
    I have tried several methods including "ftp://user:pass@domai n.com/public_html/" etc. I've also tried adopting port 80 access. I am rather new to C# so I may not come across as very competent here.

    Your suggestions and answers are much appreciated,
    Thank you.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    What is your server platform?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      if you have windows(samba) sharing allowed, try the UNC path type of "\\myserver\mys criptfolder\myf ile.txt" and the like.

      StreamWriter and all other file actions are looking for a "hard" link to a file. You have to be able to get there via some sort of standard file-system structure (such as opening up "My Compter" in windows and picking your harddrive, or picking a remote computer from "Network Places")

      If you wanted to setup some kind of (Secure) php script on the server for it, you could make your windows app POST the script (like you would in a form) using the WebRequest object.

      Comment

      • Deviant
        New Member
        • Jun 2007
        • 2

        #4
        Thank you.

        This has resolved my issue.

        PS: The POST action was perfect, it removed a clunky cron job.

        Comment

        Working...