Does a Silverlight share the HTTP connection of its host
Does a Silverlight video player share the HTTP connection with its host?
Here is the scenario: a web site is password protected. The web page contains a Silverlight control with a video player. The video player plays a video from the same web site. Will the credentials from the web browser be used by the video player? I use MediaEl开发者_如何学运维ement.Source to specify where the video is coming from.
If not, how can I fix this?
That depends on the way it communicates with the server... for example the webrequest
class can be set to use BrowserHTTP
or ClientHTTP
...
BrowserHTTP
uses the browser's HTTP implementation including Referer, Cookies etc.
ClientHTTP
allows you to manage HTTP setting like Cookies manually...
Using MediaElement.SetSource
you can leverage whatever connection you please (BrowserHTTP
/ ClientHTPP
) with you specific settings (including Authorization
header / Cookies
etc.) as log as that connection provides a Stream
interface for the content...
Further details see
http://msdn.microsoft.com/en-us/library/system.net.browser.webrequestcreator.browserhttp%28v=vs.95%29.aspx
http://msdn.microsoft.com/en-us/library/system.net.browser.webrequestcreator.clienthttp%28v=vs.95%29.aspx
http://msdn.microsoft.com/en-us/library/cc838250%28v=vs.95%29.aspx
http://msdn.microsoft.com/en-us/library/cc190669%28v=vs.95%29.aspx
精彩评论