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.