public ActionResult Frame(string url = "https://www.onliner.by/") { //TODO:FIX THIS SHIT if (Session[SessionNameDocument] == null) { var request = HttpWebRequest.CreateHttp(url); var response = (HttpWebResponse)request.GetResponse(); var stream = response.GetResponseStream(); MemoryStream streamMemoryStream = new MemoryStream(); stream.CopyTo(streamMemoryStream); streamMemoryStream.Position = 0; _htmlPageDocument.InitDocument(streamMemoryStream); var str = _htmlPageDocument.GetElementByXPath( "/html[1]/body[1]/div[1]/div[1]/div[2]/header[1]/div[1]/div[1]/nav[1]/ul[1]/li[1]/a[1]/span[1]");//TODO:DELETE AFTER TEST Session[SessionNameDocument] = _htmlPageDocument; this._htmlPageDocument.TestMethod("//script"); this._htmlPageDocument.AddHtmlToDocument("//head", "<script src='/Scripts/Subscriptor/Selector.js'></script>"); this._htmlPageDocument.AddHtmlToDocument("//head", "<script src='/Scripts/Subscriptor/Subscriptor.js'></script>"); this._htmlPageDocument.AddHtmlToDocument("//head", "<link href='/Content/Site.css'rel='stylesheet'/>"); this._htmlPageDocument.AddHtmlToDocument("//head", "<script src='/Scripts/jquery-1.10.2.js'></script>"); this._htmlPageDocument.AddClassToElements("//body", "testCssClass"); this._htmlPageDocument.AddIdToAllElements("//body"); this._htmlPageDocument.SaveDocument(); return(View("Frame", null, this._htmlPageDocument.GetAsString())); } else { _htmlPageDocument = (IHtmlPageDocument)Session[SessionNameDocument]; return(View("Frame", null, this._htmlPageDocument.GetAsString())); } }
public HomeController(IHtmlPageDocument htmlPageDocument, IDataBaseService service) { _htmlPageDocument = htmlPageDocument; _service = service; }