Link to home
Start Free TrialLog in
Avatar of tomhoran
tomhoran

asked on

BinaryWrite and SSL

I'm creating a PDF file on the fly and feeding it to the browser using BinaryWrite. The website is secure (runnng SSL) and when the page displays it pops up the message:

"This page both secure and non-secure items. Do you want to display the non-secure items?"

How can i make sure the binary feed u=is encrypted?
Avatar of markhoy
markhoy
Flag of United Kingdom of Great Britain and Northern Ireland image

Is the binary write (the source of the PDF) coming from the SSL folder? ie a SECURE folder?
Avatar of tomhoran
tomhoran

ASKER

i would have to say yes. the ssl is www.repayme.com and then the folder for the binarywrite comes from

www.repayme.com/admin/reports/binarywritepgm.asp (not the real name)
so they are both https:// ? including the source that you read to make the pdf? There was a post similar to this recently- I did a search on the archives but couldn't find it..

Have you looked at any tech articles on thawte.com or openssl.org?
no. I'm using crystal to create the .pdf file stream, here is my code:


Set oApp = Server.CreateObject("CrystalRuntime.Application.9")
Path = Request.ServerVariables("PATH_TRANSLATED")                    
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
     iLen = Len(Path) - 1                                                  
     Path = Left(Path, iLen)                                              
Wend

Set oRpt = oApp.OpenReport(Path & ReportName, 1)
Set oPageEngine = oRpt.PageEngine
Pagehelper = Array()
Set oPageGenerator = oPageEngine.CreatePageGenerator(PageHelper)

recordsel = "{reimburse_check.delivery_method} = 'L' " & _
     "and {reimburse_check.cust_no} = '" & custno & "' " & _
     "and {reimburse_check.process_no} = " & whichproc & _
     whichcmp
oRpt.RecordSelectionFormula = CStr(recordsel)

oRpt.ParameterFields.GetItemByName("plain_paper").AddCurrentValue(CStr(plainpaper))
oRpt.ParameterFields.GetItemByName("test_check").AddCurrentValue(CStr(testcheck))

'///////////////////////////////////////////////////////////
'//  Use the report object and the export options object  //
'//  to set up the export type and destination.         //
'///////////////////////////////////////////////////////////

With oRpt
     .MorePrintEngineErrorMessages = False
     .EnableParameterPrompting = False
          With .ExportOptions
               .DestinationType = DestinationType
               .FormatType = FormatType
          End With
End With

With Response
     .Expires = 0
     .Buffer = True
     .Clear
     .ContentType = "application/pdf"
     .BinaryWrite oPageGenerator.Export(8209)
End With
no. I'm using crystal to create the .pdf file stream, here is my code:


Set oApp = Server.CreateObject("CrystalRuntime.Application.9")
Path = Request.ServerVariables("PATH_TRANSLATED")                    
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
     iLen = Len(Path) - 1                                                  
     Path = Left(Path, iLen)                                              
Wend

Set oRpt = oApp.OpenReport(Path & ReportName, 1)
Set oPageEngine = oRpt.PageEngine
Pagehelper = Array()
Set oPageGenerator = oPageEngine.CreatePageGenerator(PageHelper)

recordsel = "{reimburse_check.delivery_method} = 'L' " & _
     "and {reimburse_check.cust_no} = '" & custno & "' " & _
     "and {reimburse_check.process_no} = " & whichproc & _
     whichcmp
oRpt.RecordSelectionFormula = CStr(recordsel)

oRpt.ParameterFields.GetItemByName("plain_paper").AddCurrentValue(CStr(plainpaper))
oRpt.ParameterFields.GetItemByName("test_check").AddCurrentValue(CStr(testcheck))

'///////////////////////////////////////////////////////////
'//  Use the report object and the export options object  //
'//  to set up the export type and destination.         //
'///////////////////////////////////////////////////////////

With oRpt
     .MorePrintEngineErrorMessages = False
     .EnableParameterPrompting = False
          With .ExportOptions
               .DestinationType = DestinationType
               .FormatType = FormatType
          End With
End With

With Response
     .Expires = 0
     .Buffer = True
     .Clear
     .ContentType = "application/pdf"
     .BinaryWrite oPageGenerator.Export(8209)
End With
I think it's because the crystal dll is in the system folder and not the ssl folder so when it is called you get the message. I wish I could find the post from the other week... Are you able to copy and register the Crystal dll in the SSL folder?
not sure that's the problem as their activex view doesn't have this problem.

i talked with them and they mentioned that it had to do with the header or something not being created before the binary string was hitting the browser.
can you use a server.execute to make the file on the fly and then read it?
what would that do for me? what does "server.execute" do?
don't quote me (see the msdn site on "25 ways to improve web site performance"..
http://msdn.microsoft.com/workshop/server/asp/asptips.asp) but I think it's an IIS5 way of executing a server file ie an asp file within the body of an asp page- so you might be able to make the pdf that way
The PDF file doesn't contain any http: references, like images et al, does it?
no images at all. if i save it to a file then display it via a href it displays with no problems.
ASKER CERTIFIED SOLUTION
Avatar of markhoy
markhoy
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I got this thing figured out...I know where the problem is, just don't know why.

Here are the steps:

1: I have a window with a hyper-link. When it's clicked it opens a new window (wk1.asp), which is secure as the lock is in the status bar.

2: This new window (wk1.asp) allows the user to select what they want to include in the .pdf file/report. They fill in some fields then click a button which then does a response.redirect to wk2.asp (I've also confirmed that it's an issue when using a form/submit)

3: wk2.asp has the code to create the response.BinaryWrite and this is where/when I get the "This page both secure and non-secure items. Do you want to display the non-secure items?"

The interesting thing is, if I do a hyper link to wk2.asp instead of a response.redirect or submit I don’t get the error???
when you submit the form or use a redirect, are you using the full https://www.dom.com/w2k.asp ?
no. I don't do that with any of the other 200+ pages in the system. the page is is already within the secure site, so it shouldn't be needed
just for the heck of it i added the https:// on the submit and same error occured
I know this'll sound odd, have you tried recreating the page from scratch on overwriting the old file? Strange one!
Thanks for your help