I tried this question earlier but did not get any real answers, so perhaps I am not explaining it correctly. Let me try it this way. My program searches for a (PDF) document that is stored in a web folder online. It is then supposed to display it in an iFrame on a web-page. I have tried this two ways, both as an HTML5 web-page iFrame and also as a google docs. Code for Google Docs is shown below, but both produce the same result which is a blank page (no errors) but BOTH work perfectly run run as a localHost page from Visual Studio 10:
SqlConnection Conn = new SqlConnection(CONNSTR);
try
{
string Sql = "SELECT [NAME],[LOCATION] FROM TTW_MISC WHERE [NAME] = @NAME ORDER BY [NAME] ASC ";
SqlCommand Comm = new SqlCommand(Sql, Conn);
Comm.CommandType = CommandType.Text;
Comm.Parameters.Clear();
Comm.Parameters.AddWithValue("@NAME", "TTW_Story.pdf");
SqlDataAdapter da = new SqlDataAdapter(Comm);
DataSet ds = new DataSet();
da.Fill(ds);
location3 = ds.Tables[0].Rows[0]["LOCATION"].ToString();
CEO1 = ds.Tables[0].Rows[0]["NAME"].ToString();
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.Message);
}
Session["Document"] = location3 + CEO1;
Response.Redirect("TTW_Doc_Reader.aspx", false);
if (Session["Document"].ToString() != string.Empty)
{
string document = Session["Document"].ToString();
string pdfPage = "http://docs.google.com/gview?url=" + document + "&embedded=true";
pdiFrame.Attributes.Add("src", pdfPage);
}
else
{
ClientScriptManager script = Page.ClientScript;
if (!script.IsClientScriptBlockRegistered(this.GetType(), "Alert"))
{
script.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Sorry, this document cannot be found. ')", true);
return;
}
}
Since it works perfectly when it is run in VS 10, I "ASSUME" that the it is being passed correctly online since it is the same page, and a check in the loaded page source appears to verify that, but all I get is a blank page. All I can think of is some kind of security issue that is not letting the page come down from the server, but I do not know how to check this, or even if I am on the right track. Why does it work from the desktop? I'm more than a week on this now. I have received great assistance from Code Project over the years and have always resolved the problem. I thank you in advance for your assistance! PLEASE PLEASE HELP. Thanks again, Pat.
What I have tried:
I have tried both Google docs and HTML 5 iFrame direct code. I have verified the source document and it's existence. I have checked the code for accuracy and it resolves perfectly when run in Visual Studio 10. I have checked the web page source to make sure it is looking for a real page and that the page format code is correct (which it must be since it is found and displayed perfectly in both formats when run from the localhost). I have tried 3 different browsers (Firefox, Chrome, Explorer). I have decimated the internet with searches for any similar issue and I have found nothing that matches my issue, considering mine already works when done from the VS locahost.