I have an asp.net MVC site and a controller action that looks like this:
public ActionResult GeneratePPT(MyParams deckParams)
{
string template = Server.MapPath("/PPTTemplate.pptx");
var results = _model.GeneratePPT(template);
return File(results.Content, "application/vnd.ms-powerpoint", results.FileName);
}
The issue is: MyParams
object is getting very large (lots of parameters) so I would like to change this from a querystring to an ajax post to avoid long querystring issue (as I'm hitting the limit for Internet Explorer of 2083 characters in the URL.
the problem is that I don't see how I could return a file as part of a JsonResponse so I'm looking for recommendations on how I could both:
- Get around the Internet Explorer 2083 character limit in URL
- Have the ability to return a PowerPoint file
I had an idea of doing an ajax post to the server, having the server save a file and just return a path in a jsonResponse. Then have the client hit the server again to get the file. Does this make sense? Is there a more elegant way to do this in one step?