farshad Posted January 7, 2004 Posted January 7, 2004 Hi, In my win application I use the following code to save the downloaded data into the necessary format sw = File.CreateText(strPath & ".csv") please not ethat .csv can be .xml instead This works fine but what should I do in web (asp.net)? I can not use the above line as it complains about the network path where the file should be installed. If the best way is to get a dialog box to save as then how is it done please? thanks Quote Farshad
Administrators PlausiblyDamp Posted January 7, 2004 Administrators Posted January 7, 2004 Do you want to save the data to the server or the client PC via their browser? To prompt the browser to save use something similar to: 'Send data to client Response.ContentType = "text/csv" 'Set the data type Response.AppendHeader("Content-disposition:", "file; filename = Test.txt") 'Set the suggested filename Dim s As IO.Stream = Response.OutputStream 'use s as a normal stream streamwriter etc. Dim sw As New IO.StreamWriter(s) sw.WriteLine("Data here") sw.Flush() sw.Close() Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
farshad Posted January 7, 2004 Author Posted January 7, 2004 Hi, I would like to save on the network (Neither the server nor the client but another machine on the network) Thanks Quote Farshad
Administrators PlausiblyDamp Posted January 7, 2004 Administrators Posted January 7, 2004 You will need to make sure the account the asp.net service runs under has permissions to the network then. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
farshad Posted January 7, 2004 Author Posted January 7, 2004 How is this done? The web server is currenly my pc. Thanks Quote Farshad
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.