Rank: Newbie Groups: Member
Joined: 4/1/2015 Posts: 1
|
How can I add a cookie when downloading the pdf generated from MVCtoPDF?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
You won't be able to send the cookie and PDF file to the client on the same request. So it has to be separate requests. For example, you can code to implement this logic:
1. User click "Convert to PDF" button; 2. Inside your button handler you set the cookie. The response carries the cookie to the client side; 3. The client side JavaScript automatically post the page and raises another server event; 4. Inside that server event you would convert to the PDF and send the result to the client;
Note that here step 2 and step 4 are two different responses. The cookies are sent to the client on step 2 and the PDF is sent to the client on step 4. Step 3 is used to chain them together.
Thanks!
|