Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

c# - How to load mht from stream/string into a WebBrowser control?

The WebBrowser control loads properly any mht file if I use the Navigate method, but when I use the DocumentText or DocumentStream properties, the source of the mht file is displayed as if I opened the file in notepad.

If I write the stream to a temp file then Navigate to it, it works properly, but I don't want to do it this way.

This issue seems common, but I didn't find a working solution for it. Some people suggest I should fool IE by implementing IPersistMoniker com interface, ...etc. I have tried with this a little bit, but unfortunately I got the same result. May be I have done something wrong. I still feel their should be a more straightforward solution (other than saving in a temp file first), any idea?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I remember I was facing the same issue a few years ago and although I searched for a solution then I did not find any. In the end, I went for the temp-file approach. I wish you good luck, and if there's an answer I would like to know too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...