Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This might be helpful for whoever else faces this problem. I finally figured out a solution. Turns out, even if we use the inline for "content-disposition" and specify a file name, the browsers still do not use the file name. Instead browsers try and interpret the file name based on the Path/URL.</p> <p>You can read further on this URL: <a href="https://stackoverflow.com/questions/381890/securly-download-file-inside-browser-with-correct-filename">Securly download file inside browser with correct filename</a></p> <p>This gave me an idea, I just created my URL route that would convert the URL and end it with the name of the file I wanted to give the file. So for e.g. my original controller call just consisted of passing the Order Id of the Order being printed. I was expecting the file name to be of the format Order{0}.pdf where {0} is the Order Id. Similarly for quotes, I wanted Quote{0}.pdf.</p> <p>In my controller, I just went ahead and added an additional parameter to accept the file name. I passed the filename as a parameter in the URL.Action method.</p> <p>I then created a new route that would map that URL to the format: <a href="http://localhost/ShoppingCart/PrintQuote/1054/Quote1054.pdf" rel="nofollow noreferrer">http://localhost/ShoppingCart/PrintQuote/1054/Quote1054.pdf</a></p> <pre> <code> routes.MapRoute("", "{controller}/{action}/{orderId}/{fileName}", new { controller = "ShoppingCart", action = "PrintQuote" } , new string[] { "x.x.x.Controllers" } ); </code> </pre> <p>This pretty much solved my issue. Hoping this helps someone!</p> <p>Cheerz, Anup</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload