Hi thanks for your reply.
Yes it is ASP.NET.  I inherited this app and am still trying to figure
out what is going on.
 I was wondering how they wanted me to decide where to
put the file on the user's computer.   So this implies that the error
message I am getting

                hlSendFile.NavigateUrl = "../IMD_MSIS/send_files/" +
file_name;

probably means that this directory doesn't exist on the server where
the application is running?

 The page after the file is created does have a link that the  user is
supposed to right click on and
do a "Save As" so it really is their choice, exactly like you said.

So it seems i  need to make the path 'relative' so the application can
be moved
from development to production servers, and their directory structures
don't need to be the
same?

Thanks!
Myra



On Jun 26, 12:41 am, Cerebrus <[email protected]> wrote:
> Is this a web (ASP.NET) application ? Seems so because of the use of
> the hyperlink controls.
>
> As an ASP.NET developer, it is not your prerogative to decide where a
> file will be saved on the user's computer. All you should do is
> provide a link to the file on the server and allow the user to save it
> in the desired location. The browser will handle the rest.
>
> On Jun 26, 3:04 am, Myra <[email protected]> wrote:
>
> > hi! I desperately need help.. I did peruse the group to see if i could
> > get a clue, but this problem seems like it should be much simpler.  I
> > am new to .NET and web programming in general and bet this really is a
> > dumb question...
>
> > I have a .NET C# application.  The user fills in some values and a
> > file is supposed to be written to their computer. ( The app lives out
> > on a server )
>
> >  I need to change string imd_dir = "C:\\Inetpub\\wwwroot\\IMD\
> > \send_files\\";
> > to a 'relative path' as this directory structure is not on the user's
> > computer.
>
> > All i was told was to 'make it a relative path' .  It can be any path
> > I choose. I suppose having the file written to /My Documents/username/
> > file.txt would be best.
>
> > Can someone tell me how to change this hardcoded path to ANYTHING that
> > will work?
>
> > What happens now is a popup that says:
> > "Internet Explorer cannot download MMH2009Q3.TXT from localhost.
> > Internet Explorer was not able to open this Internet Site.  The
> > requested site is either unavailable or cannot be found.  Please try
> > again later."
>
> > My development box does not have the hardcoded path below but neither
> > will the user's machines.
>
> > i do not know what this line is doing either but i think it might be
> > part of the problem:
> > hlSendFile.NavigateUrl = "../IMD_MSIS/send_files/" + file_name;
>
> > TIA for any advice/comments etc...
> > Myra
>
> > The code is like this:
>
> > string imd_dir = "C:\\Inetpub\\wwwroot\\IMD\\send_files\\";
> > string file_name = "MMH" + report_year.ToString() + "Q" +
> > report_quarter.ToString() + ".TXT";
>
> > StreamWriter writer = new StreamWriter(imd_dir +
> > file_name,false,System.Text.Encoding.ASCII);
>
> >         while(dr.Read())
> >         {
> >                 if (!dr.IsDBNull(1))
> >                 {
> >                         rec_line = dr.GetString(1);
>
> >                         writer.WriteLine(rec_line.PadRight(300, ' '));
> >                 }
> >                 }
> >                 writer.Close();
>
> >                 hlSendFile.NavigateUrl = "../IMD_MSIS/send_files/" + 
> > file_name;
> >                 }
> >                         else  ... // do some other stuff.

Reply via email to