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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted Jun 10, 2010, 7:54 AM EDT
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();
}
Manath Pathana86 reputationPosted Jun 10, 2010, 5:31 PM EDT
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
Manath Pathana86 reputationPosted Jun 10, 2010, 7:48 PM EDT
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
Jaish MathewsRank #225 · 11K reputationPosted Jun 11, 2010, 12:07 AM EDT
You need to pass the file name to this method.
Close the thread if helped.