You need to sign in to do that
Don't have an account?

Exception while calling getContent()
Hi,
I am trying to get the content from a VF page and store it as an attachment. So i am doing below:
PageReference pg = new PageReference('/apex/myDoc?oppId=' + oppId);
pg.setRedirect(true);
Attachment att = new Attachment();
att.Body = pg.getContent(); <--- Here i get java.net.SocketException: Connection reset but it is intermittent and not reproducible.
Any idea why is this happening?
Thanks for the help!!
Can you pls provide more information, like where are you sung this code?
Hi,
This is used for dynamically generating a PDF document from the values on the opportunity object and also saving the same PDF as an attachment to the opportunity record.
Thanks.
In a controller?!
Yeah thats right.