I have the need to display PDF documents inside a silverlight application. I implimented a xamWEbHtmlviewer and set the SourceUri to an pdhHandler.ashx. the handler gets a PDF document stored in the session state from a previous web service call (dont ask why... thats how our web client architechure is and i have to re-use this for now).
when the xamwebhtmlviewer gets its sourceuri set it does not look like it uses the same IIS session when it calls the handler, thus does not find the pdf. Would you expect the xamwebhtmlviewer to call the web server with the same IIS session that the rest of the silverlight application is using?
i should clerify the IIS session is set up through a web service call that has
AspNetCompatibilityRequirements.Allowed attributed on the WCF service handler...
In this case all the XamHtmlViewer is doing is creating an iFrame pointing to the SourceUri. The iFrame is located in a <DIV> element and then overlaid on top of the Silverlight ActiveX control embedded in the page. If you check the host page DOM you will see this iFrame.
Because thats all thats happening, I'm not sure if the control is whats causing the problem. I do have a couple of ideas/suggestions that you can try to check:
- Do you have the aspNetCompatibilityEnabled attribute set to True in your config file?
- If the first service call you make originates from the Silverlight application, I am not sure if that is the same session context as the browser session the iFrame is using when it calls your URL. You might be able to use an HTTP Sniffer like fiddler to see if the HTTP request header includes the same session cookie ID.
Hope that helps at least point you in the right direction.
Devin
Thanks for the insight into how this control works, and I will try your debugging suggestions for sure too.
One major detail I left out is this approach works fine when I run it from a web page in a standard asp.net application that has the silverlight object tag in it. When it does not work is when I run the same silverlight application from a SharePoint 2010 page using the built in silverlight web part. i think i will start by debugging other options then the Silverlight web part and see if I can narrow it down to one scenerio or another. knowing it generates an Iframe is key to understanding what might go wrong.
I know that throws a hudge monkey wrench of unknows into the equation. thanks for the feedback.
I'm Almost there... I created a custom Silverlight wrapper web part fro sharepoint and host the control in that with enableHtmlAccess = true. that works and i can see the PDF files in my document viewer application.
the last pain point is if i scroll down on the page after it initially loads the silverlight control the DIV gets addded to the wrong location. it is above the silverlight control by the abount i scrolled down on the page. Somehow i need to tell the control to recalulate the page's target location for the DIV to be added. Any suggestions? i tried (i was guessing on these) this.layoutroot.invalidaterange and invalidatemeasure but to no evail...
thanks!
Unfortunatly the control needs this attribute to be set to True so that it can access and manipulate the browser DOM.
I was finally able to narrow this down to enableHtmlAccess parameter. in My application it was enabled, sharepoint by default has this off. I dont think I can change this either due to security.
in other words, in my app where it dod work I added
<
param name="enableHtmlAccess" value="false" /> and it no longer worked. Any ideas how to make this control work when enableHtmlAccess is false?
I have validated that the moment I add the xamWebHtmlViewer control to a xap file hosted in SharePoint 2010 (using the OOB Silverlight Web Part) the Sl app will no longer render. I looked at all the param values generated by SharePoint and made my custom application have the exact same params, but O still cannot duplicate the issue outside of a Sharepoint 2010 page. FUSTRATING!
I have been elbow deep into the SharePoint page html code, but cannot find out why the control is blank once I Add the xamwebHtmlViewer control even if I dont set the SourceUri.