samedi 4 août 2018

How can I render page on the back-end side using asp.net mvc4 if I have only URL?

env: ASP.NET MVC 4 On my back-end I recieve an URL from some outer API, I want to render this page on the back-end side and then pass it to my view, and open in the new browser window. Now I've just gotten clear content (html), e.g.:

webCl.DownloadString(result.Headers[HttpResponseHeader.Location]);

or

var result = (HttpWebResponse)request.GetResponse();
    StreamReader sr = new StreamReader(result.GetResponseStream(), System.Text.Encoding.UTF8);
    string result2 = sr.ReadToEnd();

And then I create the new window on view and put this html there:

window.child = window.open('','win name','width=' +width +',height=' +
                        height +
                        ',menubar=0,toolbar=0,directories=0,scrollbars=no,resizable=no,left=' +
                        position_x +',top=' +position_y);
                    window.child.document.write(html_from_back-end);

But, I want render it with all the resources (js, css etc) like a browser do, because of course now it looks terrible witout rendering.

Are there any ways to resolve this issue ?

Aucun commentaire:

Enregistrer un commentaire