W
Wayne Brantley
Here is the test case:
Create a new asp.net project.
put a file - test.pdf in the web application directory.
add a a button and a hyperlink to webform1.aspx
The hyperlink - simply links to the pdf.
The button - simply opens the pdf, reads the data and writes it to the
response object - code below.
All works just fine.
Now, enter the problem. Change the url to be secure (change to https).
The hyperlink works as expected.
Upon clicking the button you get a message box saying 'this page contains
both secure and unsecure items' Would you like to display the unsecure
items - you can choose yes or no.
No matter what you choose, the pdf page displays properly and works fine -
you just get that annoying message.
Button click code:
FileStream fs=File.Open(MapPath(".")+"\\test.pdf", FileMode.Open);
try{
BinaryReader reader = new BinaryReader(fs);
try{
byte[] result = null;
//note in this test case, I have used a pdf file that is like 27k in size,
so this 32000 byte read is just for simplificatoin...
result=reader.ReadBytes(32000);
Response.Clear();
Response.ContentType="application/pdf";
Response.OutputStream.Write(result, 0, result.Length);
Response.End();
} finally{
reader.Close();
}
}finally{
fs.Close();
}
I created the above example just to show the problem. I actually ran into
the problem when trying to show the PDF returned from ReportingServices
webservice, but simplified it down to this.
How do I get rid of this warning message?
Wayne Brantley
Create a new asp.net project.
put a file - test.pdf in the web application directory.
add a a button and a hyperlink to webform1.aspx
The hyperlink - simply links to the pdf.
The button - simply opens the pdf, reads the data and writes it to the
response object - code below.
All works just fine.
Now, enter the problem. Change the url to be secure (change to https).
The hyperlink works as expected.
Upon clicking the button you get a message box saying 'this page contains
both secure and unsecure items' Would you like to display the unsecure
items - you can choose yes or no.
No matter what you choose, the pdf page displays properly and works fine -
you just get that annoying message.
Button click code:
FileStream fs=File.Open(MapPath(".")+"\\test.pdf", FileMode.Open);
try{
BinaryReader reader = new BinaryReader(fs);
try{
byte[] result = null;
//note in this test case, I have used a pdf file that is like 27k in size,
so this 32000 byte read is just for simplificatoin...
result=reader.ReadBytes(32000);
Response.Clear();
Response.ContentType="application/pdf";
Response.OutputStream.Write(result, 0, result.Length);
Response.End();
} finally{
reader.Close();
}
}finally{
fs.Close();
}
I created the above example just to show the problem. I actually ran into
the problem when trying to show the PDF returned from ReportingServices
webservice, but simplified it down to this.
How do I get rid of this warning message?
Wayne Brantley