I Have an Upload Manager and I want to return a File when user called a special Method of My Control Like this:
www.website.com/upload/getfile/?fileID=100
how Can I do this?
I want to know how Can I return a file!
I found my answer and I wrote the sample code below:
public FilePathResult GetFile(string Name)
{
FilePathResult s = new FilePathResult(@"C:/"+Name, "File");
Response.Headers.Clear();
return s;
}
but there is a problem now.Is there any problem if I use File for my ContentType.Because I don’t know it.
Make a controller named
uploadController, with an action namedgetfilewhich has an argument.Then the above url can be changed to
UPDATE:
Change the return type of action to
FileResultFor complete answer take a look at part of my codebase: