Hi dear,
I have a problem with asp page.
I want to download file from server that I uploaded.
But i can not do, If all can do please tell me by send
source for me too.
thank advance.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaish MathewsPosted Jun 10, 2010, 11:54 AM
string file = Server.MapPath(@"Data\Info.txt");
if (File.Exists(file))
{
FileInfo fInfo = new FileInfo(file);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fInfo.Name);
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.ContentType = "application/txt";
Response.WriteFile(fInfo.FullName);
Response.End();
}
Jaish MathewsPosted Jun 11, 2010, 4:07 AM
You need to pass the file name to this method.
Close the thread if helped.
Manath PathanaPosted Jun 10, 2010, 11:48 PM
Now I can resolve it. thank for your code.
But I want to download multi-file from Server.
You know about it? it you know please tell me
by send source code.
Best Regard
Mala
Manath PathanaPosted Jun 10, 2010, 9:31 PM
Thank for reply.
but i try do and follow this code
but can not process. it show error.
I want to ask you, when download all file in IIS or it can stay
other folder that not in IIS?
Please See Error Below:
Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '???'.
Line: 4723
Char: 21
Code: 0
URI: http://localhost:9720/ScriptResource.axd?d=jR1WPFCNKIlRXuCamwZa-Tg9qL4KXifHiTJ47YVqRexv2XXUdVnsKk-HBAbRD6nXH6t-KcCCHmWjn_ZkSMVknNNxllqCLQStmaFT2RpOMKA1&t=ffffffffe7c74318