file downloading prblm
-
I'm downloading a file from server using this code Response.Clear() Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) Response.AddHeader("Content-Length", file.Length.ToString()) Response.ContentType = "text/plain" Response.WriteFile(file.FullName) Response.End() it's working fine but i've to clear the page cache below the code Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") i'm clearing the cache using above code both r working fine but i'm unable to open the downloaded file through save as dialog box the problem is clearing the cache.. But I've to clear the cache.. how can I do both things .. help me plz
-
I'm downloading a file from server using this code Response.Clear() Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) Response.AddHeader("Content-Length", file.Length.ToString()) Response.ContentType = "text/plain" Response.WriteFile(file.FullName) Response.End() it's working fine but i've to clear the page cache below the code Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") i'm clearing the cache using above code both r working fine but i'm unable to open the downloaded file through save as dialog box the problem is clearing the cache.. But I've to clear the cache.. how can I do both things .. help me plz
-
it's not working
-
it's not working
try using this code it may help you for downloading System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" ); response.Flush(); response.WriteFile("File"); response.End(); :cool:
-
I'm downloading a file from server using this code Response.Clear() Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) Response.AddHeader("Content-Length", file.Length.ToString()) Response.ContentType = "text/plain" Response.WriteFile(file.FullName) Response.End() it's working fine but i've to clear the page cache below the code Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") i'm clearing the cache using above code both r working fine but i'm unable to open the downloaded file through save as dialog box the problem is clearing the cache.. But I've to clear the cache.. how can I do both things .. help me plz
Vanamaindia wrote:
how can I do both things ..
You told, methods used by you are working fine. Then what's the issue here ?
Vanamaindia wrote:
but i'm unable to open the downloaded file through save as dialog box
What do you mean by this ? SaveAs dialog will be shown by the browser. So I don't think that you can control that.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
try using this code it may help you for downloading System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" ); response.Flush(); response.WriteFile("File"); response.End(); :cool:
It's not working uma
-
It's not working uma
-
Dear, This code working perfectly i had already tried it. You should try google and also try that code in different browser
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" ); response.Flush(); response.WriteFile("File"); response.End(); use this code in page load Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") after that u add ur code in button click.. try this one...