Upload a page from an html string

0

I have the following doubt that, I believe that although it is a beast, it is giving me a beauty of a job.

Next, I have a variable of type string and I need to perform a method that will receive this code and display the page in a new tab. I was using the SelectPdf library to convert this string to a PDF but when using with azure it does not work so I lost it here. Can anyone help me?

    
asked by anonymous 28.09.2015 / 20:10

2 answers

0

Let's see, you could create an HTML file based on your string using the IO class, which would take it and transform it into a file, and write it in the same location as your application. Then I just opened it using:

System.Diagnostics.Process.Start (" link ");

And only. I've done this many times.

Let's see, I realized that you did not quite understand what I mean, so I'll demonstrate with this pseudocode:

string suaString = "<!DOCTYPE html><html>...</html>";
StreamWriter escritor = new StreamWriter(@"...\paginaQueDesejo.html");
escritor.WriteLine(suaString);
escritor.Close();

// Pronto, sua pagina foi criada e está pronta para ser exibida, agora é só exibí-la.
System.Diagnostics.Process.Start(@"...\paginaQueDesejo.html");

Only this, I do not know if this will solve your problem, but in most cases this is a simple and efficient solution.

    
29.09.2015 / 13:55
0

Do you just need to open a web page from a link in your application?

If so, try:

System.Diagnostics.Process.Start("http://seu_site_aqui");

To open in new tab, you can use the target=_blank attribute in a simple link, for example:

<a href="http://seu_site_aqui" target="_blank" >Clique aqui</a>
    
28.09.2015 / 20:25