Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my controller I return a file,it is OK.But in the view,I use `location.href=url`,sometimes if the url parameter is too long,I can not download the file.Is the max length of url is 1024B?How to solve the solve the question if the question if the url parameter is too long?Must I change the view code,or change the iis config?
C#
**MVC View function**

      //studentName may be very long
      function GetFile(){
          var searchCondiction = {
                    studentName: $("#studentName").val(),
                    startDate: $("#UploadYear").val(),
                };
         location.href = "@Url.Action("GetFile", "Student")?" + $.param(searchCondiction );
        }

**MVC Controller function**

    public ActionResult GetFile(string studentName,DateTime startDate)
    {
    //Product file according to  studentName and startDate
    ...
    //Return file
    Return File(Server.MapPath("~/App_Data/UserA/a.png"),"imge/png");
    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900