downloading file from silverlight application
I'm trying to open downloaded files in a new window from my silverlight application. We have a legacy application written html/js which works fine for any filetype. However, in my SL application,开发者_如何学Python for any file type not .txt or .html, a window briefly pops up and closes. I follow along in fiddler and the requests are identical for both apps. To further explain what I'm doing, I use System.Windows.Browser.HtmlPage.Window.Invoke to invoke a js function that calls window.open. Does anyone have an idea what might be going on here?
here are the headers...
Request:
GET https://foofoo.com/portal/fileDownload?SupportingUploadedFileId=8147&IdeaId=110391 HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Host: foofoo.com
Connection: Keep-Alive
Cookie: __utma=42251826.1339254382.1292255942.1292255942.1292255942.1; __utmz=42251826.1292255942.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=95617934.1162172004.1292440807.1292618204.1292859812.4; __utmz=95617934.1292440807.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); hubspotdt=2010-12-20%2010%3A43%3A36; hubspotutk=027b6ef3c2cb40a7a727706cbd686cd0; hubspotvd=027b6ef3c2cb40a7a727706cbd686cd0; hubspotvw=027b6ef3c2cb40a7a727706cbd686cd0; hubspotvm=027b6ef3c2cb40a7a727706cbd686cd0; JSESSIONID=UXFMkU3DZrCKhpn9Gk7cvQ**; __utmb=95617934.1.10.1292859812; __utmc=95617934
Response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0
Content-Disposition: attachment; filename=DBSchema1.pdf
Pragma: public
Cache-Control: cache
Content-Type: application/pdf
Transfer-Encoding: chunked
Date: Mon, 20 Dec 2010 15:49:00 GMT
Contents of file
I found a solution. Instead of calling System.Windows.Browser.HtmlPage.Window.Invoke() to invoke my js function that is really just window.open(), I found that System.Windows.Browser.HtmlPage.PopupWindow(uri, "_blank", null) works. Which leads to the question, what's the difference?
精彩评论