c# - Download file from ASP.NET MVC 2 site -


i'm trying implement controller can download files (more jar-archives). files stored on disk , not in database. far have come this:

public filepathresult getfile(string filename)  {        return file(path.combine(server.mappath("~/app_data/bundles"), filename), "application/java-archive"); } 

nevermind lack of error handling , such @ time. file downloaded way, gets wrong name. instead of, example, "sample.jar" file gets controller's name, "getfile", (without extension).

any ideas on doing wrong?

use overload allows specify filedownloadname.

return file(path.combine(server.mappath("~/app_data/bundles"), filename),             "application/java-archive",              filename); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -