Click here to Skip to main content
16,020,186 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I am calling the webservice for getting the byte array stream and after getting this Byte stream , i need to convert the byte stream to base64string and save this into local file with appropriate file format and that file, i need to open in a web browser.

Thanks
Chiranjeevi
Posted
Updated 16-Feb-12 11:32am
v2
Comments
[no name] 16-Feb-12 17:33pm    
Since the subject says WEB BROWSER I think your question is answered.
Sergey Alexandrovich Kryukov 16-Feb-12 21:50pm    
No. See: System.Windows.Forms.WebBrowser or System.Windows.Controls.WebBrowser (WPF) -- question is not answered. OP should tag UI library.
--SA
[no name] 16-Feb-12 22:10pm    
Pedantic and an ass. What a great combination.

It doesn't matter what CONTROL is used it's still a WEB BROWSER. In case you didn't know both controls just instantiate an instance of Internet Explorer, which to the best of my knowledge is a WEB BROWSER.
[no name] 16-Feb-12 17:34pm    
What part are you having difficulties with?
Sergey Alexandrovich Kryukov 16-Feb-12 21:51pm    
So, please give us exact type of this control (please see my comment above).
And yes, what's the problem?
--SA

1 solution

As SAK points out: you really need to clarify which technology, WPF, or WinForms, you are using here.

And, most important you need to tell us:

1. You wrote: "I am calling the webservice for getting the byte array stream and after getting this Byte stream , i need to convert the byte stream to base64string and save this into local file with appropriate file format."

This elaborate transformation system suggests to me ... that if we knew exactly what format the original data was in, we "might" be able to help you reduce the complexity of the process you describe here. If the source is already some kind of file: what type of file is it ?

2. what the file-type format you are going to display ultimately in the WebBrowser is: is it HTML ... or ?

... which leads to ...

I am sure you are already aware of displaying Office files via VSTO Automation in a a Web-Browser, or strategies to show PDF files using Adobe's api's. You are probably aware there are 3rd. party commercial tools that will convert RTF and HTML back-and-forth.

Are you, also, aware that in both WinForms and WPF the WebBrowser Control can display certain file types ... that are NOT HTML ... directly: for example, graphics files, .png, .jpg. And, text files. In WPF you may get a dialog pop-up, based on your security settings (I guess) that asks you if want to "download" the file: I do not get this dialog in WinForms on the same machine with the same security settings.

I have not looked, in a while to see all the other non-HTML file types the currrent versions of the WebBrowser Control will display: last time I looked, in WinForms, trying to display an RTF file would simply launch the default RTF viewer, which is not surprising.

In WinForms, you can set the 'URL property of the WebBrowser Control to a valid file path: in WPF you can set the 'Source property of the WebBrowser Control to a valid path file path.

Example: in WPF:
<window x:class="TestWBinWPF.MainWindow" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<grid>
    <webbrowser height="311" horizontalalignment="Left" name="webBrowser1">
    VerticalAlignment="Top" Width="503"
    Source="C:\Users\Ur\Desktop\Graphics\Bill.png" />
</webbrowser></grid>
</window>
In a WinForms (Designer.cs view): here's what you might see generated:
//
// webBrowser1
// 
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(1166, 552);
this.webBrowser1.TabIndex = 0;
this.webBrowser1.Url = new System.Uri("file:///C:\\Users\\Ur\\Desktop\\Graphics\\Bill.png", System.UriKind.Absolute);
//
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900